#5482 closed bug (duplicate)
Sizzle pseudo-selectors blow up with nested brackets
Reported by: | jakkob | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | selector | Version: | 1.4.4 |
Keywords: | find crash bracket parenthesis has contains | Cc: | |
Blocked by: | Blocking: |
Description
Using a bracket ')' in the contains filter crashes firefox.
Escaping the bracket by '
' or by '\' does not work, either. Neither the bracing or omitting of "" around the contains expression helps.
To test this, I copied the souce from http://en.wikipedia.org/wiki/Banana to my server and addded following to the header.
<script> $(document).ready(function(){
var exp = ':contains("fleshy edible inner portion
)")';
var pos = $('body').find(exp);
console.log(pos); }) </script>
It will always reproduce the error, which according to my browser in in line 1585 of jquery-1.3.2
The current nightly crashes exactly the same.
A solution would be greatly appreciated! thx
Attachments (1)
Change History (16)
Changed 13 years ago by
Attachment: | contains.html added |
---|
comment:1 Changed 13 years ago by
I also added a complete testcase now in which I did only what I wrote at the top: Copied the source from http://en.wikipedia.org/wiki/Banana, added the script (in line 80ff).
comment:2 Changed 13 years ago by
It seems to me the error only occurs if the bracket is at the very end of the expression.
comment:3 Changed 13 years ago by
Component: | unfiled → selector |
---|
comment:4 Changed 12 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Current versions of Firefox 3.6 do not crash.
comment:5 Changed 12 years ago by
i have example when it dont work. On IE8, chrome7, mozila3.6, opera 10.6
<html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("p:contains('is')").css("background-color","red"); $("p:contains('(is)')").css("background-color","yellow"); $("p:contains('(is')").css("background-color","green"); }); </script> </head> <body> <p class="intro">1) My name is Donald</p> <p>2) I live in Duckburg</p> <p>3) My best friend (is) Mickey</p> </body> </html>
when there is two brackets all works, but with one no. No matter i add one slashes or two
comment:7 Changed 12 years ago by
Keywords: | parenthesis has contains added |
---|---|
Priority: | major → high |
Resolution: | worksforme |
Status: | closed → reopened |
Summary: | -find(':contains("something with bracket )" ')- crashes firefox 3.5.3 → pseudo-selector matching for close brackets is wrong |
Version: | 1.3.2 → 1.4.4 |
comment:8 Changed 12 years ago by
Status: | reopened → open |
---|---|
Summary: | pseudo-selector matching for close brackets is wrong → Sizzle pseudo-selectors blow up with nested brackets |
comment:13 Changed 12 years ago by
Milestone: | → 1.next |
---|
comment:14 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | open → closed |
TestCase (script in line 80 ff )