Bug Tracker

Opened 10 years ago

Closed 8 years ago

Last modified 7 years ago

#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)

contains.html (150.7 KB) - added by jakkob 10 years ago.
TestCase (script in line 80 ff )

Download all attachments as: .zip

Change History (16)

Changed 10 years ago by jakkob

Attachment: contains.html added

TestCase (script in line 80 ff )

comment:1 Changed 10 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 10 years ago by jakkob

It seems to me the error only occurs if the bracket is at the very end of the expression.

comment:3 Changed 9 years ago by dmethvin

Component: unfiledselector

comment:4 Changed 9 years ago by snover

Resolution: worksforme
Status: newclosed

Current versions of Firefox 3.6 do not crash.

comment:5 Changed 9 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 9 years ago by anonymous

comment:7 Changed 9 years ago by snover

Keywords: parenthesis has contains added
Priority: majorhigh
Resolution: worksforme
Status: closedreopened
Summary: -find(':contains("something with bracket )" ')- crashes firefox 3.5.3pseudo-selector matching for close brackets is wrong
Version: 1.3.21.4.4

comment:8 Changed 9 years ago by snover

Status: reopenedopen
Summary: pseudo-selector matching for close brackets is wrongSizzle pseudo-selectors blow up with nested brackets

comment:9 Changed 9 years ago by snover

#4729 is a duplicate of this ticket.

comment:11 Changed 9 years ago by snover

#5607 is a duplicate of this ticket.

comment:12 Changed 9 years ago by snover

#6322 is a duplicate of this ticket.

comment:13 Changed 8 years ago by danheberden

Milestone: 1.next

comment:14 Changed 8 years ago by dmethvin

Resolution: duplicate
Status: openclosed

comment:15 Changed 8 years ago by dmethvin

Duplicate of #3778.

Note: See TracTickets for help on using tickets.