Bug Tracker

Ticket #8869 (closed bug: wontfix)

Opened 4 years ago

Last modified 3 years ago

"Regular expression too complex" in Firefox 4

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

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/

Change History

comment:1 Changed 4 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 4 years ago by dmethvin

  • Owner set to nathanlogan@…
  • Status changed from new to pending

comment:3 Changed 4 years ago by nathanlogan@…

  • Status changed from pending to new

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 4 years ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to wontfix
  • Status changed from new to closed
  • Component changed from unfiled to selector

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 3 years ago by anonymous

Thanks for posting this was very very helpful!

Note: See TracTickets for help on using tickets.