Skip to main content

Bug Tracker

Side navigation

#7777 closed bug (duplicate)

Opened December 14, 2010 12:48PM UTC

Closed December 14, 2010 04:19PM UTC

Last modified January 31, 2011 05:55PM UTC

[name$="value"]-selector gives different results in 1.4.4

Reported by: mr@bwsolution.de Owned by:
Priority: high Milestone: 1.5
Component: selector Version: 1.5
Keywords: Cc:
Blocked by: Blocking:
Description

Since 1.4.4 the [name$="value"]-selector changed behavior. Try the following code with 1.4.3 and 1.4.4:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>Bug?</title>
	<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.js"></script> 
	<!-- <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.js"></script>  -->
</head>
<body>
<script type="text/javascript">
jQuery(document).ready(function(){
  var context = jQuery("div:first").html();
  // - jquery-1.4.3 IE8 (compat mode) => size==1
  // - jquery-1.4.3 IE8 (non compat mode) => size==1
  // - jquery-1.4.3 FF3.6.10 => size==1
  // - jquery-1.4.4 IE8 (non compat mode) => size==0
  // - jquery-1.4.4 IE8 (compat mode) => size==1
  // - jquery-1.4.4 FF3.6.10 => size==0
		
  alert(jQuery("input[name$=\\[test\\]]", jQuery(context)).size());
});
</script>

<div><form><input type="checkbox" name="item[0][test]" value="1" /></form></div>

</body>
</html>
Attachments (0)
Change History (4)

Changed December 14, 2010 04:19PM UTC by jitter comment:1

_comment0: Thanks for taking the time to contribute to the jQuery project by writing a bug report. \ \ The documentation for the [http://api.jquery.com/attribute-ends-with-selector/ Attribute Ends With Selector] says: \ \ > jQuery('[attribute$="value"]') \ > value An attribute value. '''Quotes are mandatory.''' \ \ [http://jsfiddle.net/jitter/xgmQt/ test case] shows it's working if you add quotes around `\\[test\\]`. \ \ But the escaped unquoted selector *should* actually work and this is a known regression. Check the ticket mentioned below for progress on this issue.1292343594320128
component: unfiledselector
milestone: 1.next1.4.5
priority: undecidedhigh
resolution: → duplicate
status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

The documentation for the Attribute Ends With Selector says:

jQuery('[attribute$="value"]')\\\\ value An attribute value. Quotes are mandatory.

test case shows it's working if you add quotes around \\[test\\].

But the escaped unquoted selector *should* actually work and this is a known regression. Check the ticket mentioned below for progress on this issue.

Changed December 14, 2010 04:19PM UTC by jitter comment:2

Duplicate of #7539.

Changed January 31, 2011 05:53PM UTC by john comment:3

version: 1.4.41.5

There wasn't a 1.4.5 release, was actually 1.5.

Changed January 31, 2011 05:55PM UTC by john comment:4

milestone: 1.4.51.5

There was no 1.4.5 release, was actually 1.5.