Skip to main content

Bug Tracker

Side navigation

#5482 closed bug (duplicate)

Opened November 10, 2009 05:40PM UTC

Closed July 11, 2011 08:12PM UTC

Last modified March 10, 2012 10:10AM UTC

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 November 13, 2009 07:01PM UTC.

    TestCase (script in line 80 ff )

Change History (15)

Changed November 13, 2009 07:03PM UTC by jakkob comment:1

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

Changed November 13, 2009 07:03PM UTC by jakkob comment:2

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

Changed June 13, 2010 06:30PM UTC by dmethvin comment:3

component: unfiledselector

Changed October 06, 2010 12:54AM UTC by snover comment:4

resolution: → worksforme
status: newclosed

Current versions of Firefox 3.6 do not crash.

Changed November 16, 2010 04:35PM UTC by bondas83@verticus.lt comment:5

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

Changed November 16, 2010 04:38PM UTC by anonymous comment:6

Changed November 19, 2010 09:48AM UTC by snover comment:7

keywords: find crash bracketfind crash bracket parenthesis has contains
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

Changed November 19, 2010 09:48AM UTC by snover comment:8

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

Changed November 19, 2010 09:48AM UTC by snover comment:9

#4729 is a duplicate of this ticket.

Changed November 19, 2010 10:05AM UTC by snover comment:10

Changed November 19, 2010 10:06AM UTC by snover comment:11

#5607 is a duplicate of this ticket.

Changed November 19, 2010 10:59AM UTC by snover comment:12

#6322 is a duplicate of this ticket.

Changed March 31, 2011 04:53AM UTC by danheberden comment:13

milestone: → 1.next

Changed July 11, 2011 08:12PM UTC by dmethvin comment:14

resolution: → duplicate
status: openclosed

Changed July 11, 2011 08:12PM UTC by dmethvin comment:15

Duplicate of #3778.