Opened 10 years ago
Closed 10 years ago
#13070 closed bug (fixed)
filter()/is() does not work correctly with attribute equals selector which contains special characters
Reported by: | Owned by: | gibson042 | |
---|---|---|---|
Priority: | high | Milestone: | 1.9 |
Component: | selector | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
filter()/is() does not work correctly with attribute equals selector which contains special characters.
Windows XP SP3. Chrome 23.
<div></div> <div></div> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> <!-- var v1 = '\\'; var v2 = '"'; var v3 = '\\"'; $('div').attr({a1: v1, a2: v2, a3: v3}); var s1 = '[a1="\\\\"]'; // [a1="\\"] var s2 = '[a2="\\""]'; // [a2="\""] var s3 = '[a3="\\\\\\""]'; // [a3="\\\""] var $q = $(s3); // works correctly console.log($q.length); // 2 console.log($q.filter(s1).length); // 2 console.log($q.is(s1)); // true console.log($q.filter(s2).length); // 2 console.log($q.is(s2)); // true // the result is wrong when jQuery contains more then one element console.log($q.filter(s3).length); // 0, should be 2 console.log($q.is(s3)); // false, should be true // the result is right when jQuery contains only one element console.log($q.eq(0).is(s1)); // result: true console.log($q.eq(0).is(s2)); // result: true console.log($q.eq(0).is(s3)); // result: true //--> </script>
Change History (3)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Component: | unfiled → selector |
---|---|
Milestone: | None → 1.9 |
Owner: | set to gibson042 |
Priority: | undecided → high |
Status: | new → assigned |
comment:3 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fix #13070: better unescaping logic in Sizzle
Changeset: 00bbbe207555d3aa9d7716bb9fc6d4e4f4bcbf1e
Note: See
TracTickets for help on using
tickets.
Here is the jsFiddle test case: http://jsfiddle.net/zR7xQ/