Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#8869 closed bug (wontfix)

"Regular expression too complex" in Firefox 4

Reported by: [email protected] Owned by: [email protected]
Priority: low Milestone: 1.next
Component: selector Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:


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/

Change History (5)

comment:1 Changed 12 years ago by dmethvin

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.

comment:2 Changed 12 years ago by dmethvin

Owner: set to [email protected]
Status: newpending

comment:3 Changed 12 years ago by [email protected]

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.

comment:4 Changed 12 years ago by timmywil

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.

comment:5 Changed 11 years ago by anonymous

Thanks for posting this was very very helpful!

Note: See TracTickets for help on using tickets.