Side navigation
#6328 closed bug (worksforme)
Opened March 21, 2010 06:24PM UTC
Closed November 10, 2010 12:19AM UTC
Attribute selector with escaped character doesn't work when used with a context
Reported by: | slaren | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | |
Component: | selector | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When filtering by attribute no results are returned if a "[" escaped character is used in conjunction with a context. No errors are reported by jQuery either.
This can be reproduced with the following code (tested with Firefox 3.6):
<html> <head> <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script> $(function() { var ctx = $("#mydiv"); // outputs "1: test[0]" $("select[name^=test]", ctx).each(function() { console.log("1: " + $(this).attr("name")) }); // no output $("select[name^=test\\\\[]", ctx).each(function() { console.log("2: " + $(this).attr("name")) }); // outputs "3: test[0]" $("select[name^=test\\\\[]").each(function() { console.log("3: " + $(this).attr("name")) }); }); </script> </head> <body> <div id="mydiv"> <select name="test[0]"></select> </div> </body> </html>
When using a selector and specify the context, or directly using .find, the selector indeed doesn't work with escaped \\\\[ \\\\]
Doesn't work:
The following works:
This one works also (but the context is not used and matches from whole document)
My question is if this is a bug in the current version and will be updated or this is how it should work?