Ticket #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: | |
| Blocking: | Blocked by: |
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
Change History
Changed 4 years ago by jakkob
-
attachment
contains.html
added
comment:1 Changed 4 years ago by jakkob
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 4 years ago by jakkob
It seems to me the error only occurs if the bracket is at the very end of the expression.
comment:4 Changed 3 years ago by snover
- Status changed from new to closed
- Resolution set to worksforme
Current versions of Firefox 3.6 do not crash.
comment:5 Changed 3 years ago by bondas83@…
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:6 Changed 3 years ago by anonymous
example - http://jsfiddle.net/MC2e7/
comment:7 Changed 3 years ago by snover
- Status changed from closed to reopened
- Summary changed from -find(':contains("something with bracket )" ')- crashes firefox 3.5.3 to pseudo-selector matching for close brackets is wrong
- Priority changed from major to high
- Version changed from 1.3.2 to 1.4.4
- Keywords parenthesis has contains added
- Resolution worksforme deleted
comment:8 Changed 3 years ago by snover
- Status changed from reopened to open
- Summary changed from pseudo-selector matching for close brackets is wrong to Sizzle pseudo-selectors blow up with nested brackets
comment:10 Changed 3 years ago by snover
comment:11 Changed 3 years ago by snover
#5607 is a duplicate of this ticket.
comment:12 Changed 3 years ago by snover
#6322 is a duplicate of this ticket.
comment:14 Changed 2 years ago by dmethvin
- Status changed from open to closed
- Resolution set to duplicate
comment:15 Changed 2 years ago by dmethvin
Duplicate of #3778.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

TestCase (script in line 80 ff )