Skip to main content

Bug Tracker

Side navigation

#8869 closed bug (wontfix)

Opened April 13, 2011 11:04PM UTC

Closed April 14, 2011 03:20PM UTC

Last modified March 14, 2012 06:50PM UTC

"Regular expression too complex" in Firefox 4

Reported by: nathanlogan@gmail.com Owned by: nathanlogan@gmail.com
Priority: low Milestone: 1.next
Component: selector Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:
Description

In Firefox 4 on OS X 10.6.7, the line below caused a JS error of "regular expression too complex":

$("#top *[contenteditable=true").keyup(function() { return false; });

Adding in the right bracket fixed it, as follows:

$("#top *[contenteditable=true]").keyup(function() { return false; });

The first version did NOT throw an error in FF 3.6.16 (or any tested version of Chrome or Safari).

Testable here: http://jsfiddle.net/nathanlogan/z9z64/

Attachments (0)
Change History (5)

Changed April 14, 2011 01:58AM UTC by dmethvin comment:1

Unfortunately, we have had trouble guaranteeing a consistently high quality of output garbage when input garbage is passed to a jQuery API call. IE9, for example, actually returns the correct element even though the closing brace is missing. Chrome 10 silently returns an empty set. And, as you've noticed, Firefox 4 is the only browser to openly complain in any way about the mess someone dealt to them.

Was there a particular resolution you had in mind for this problem? If we caught the error in FF4 there would still be the problem that this invalid selector doesn't work properly across browsers. I actually prefer the Firefox 4 situation since it actually throws some sort of error to tell you something is wrong.

Changed April 14, 2011 02:02AM UTC by dmethvin comment:2

owner: → nathanlogan@gmail.com
status: newpending

Changed April 14, 2011 04:03AM UTC by nathanlogan@gmail.com comment:3

status: pendingnew

Wow, that's wild that IE9 returns the element(s)!

My thought was that jQuery would realize that the selector was not in the proper format and drop it right there, not passing it on to the browser at all. But perhaps that's coming out of my ignorance of the inner workings of how selectors are parsed and passed on.

Changed April 14, 2011 03:20PM UTC by timmywil comment:4

component: unfiledselector
priority: undecidedlow
resolution: → wontfix
status: newclosed

Sizzle passes selectors on to the native implementation whenever possible for performance. It would be too costly to ensure consistent garbage output, as Dave indicated. Fortunately, invalid selectors will not work cross-browser and you can discover the mistake when testing.

Changed August 12, 2011 10:26AM UTC by anonymous comment:5

Thanks for posting this was very very helpful!