- Notifications
You must be signed in to change notification settings - Fork20.6k
Description
Originally reported by walde.christian@… at:http://bugs.jquery.com/ticket/14511
The code for throwing syntax errors in the CSS parser looks as follows:
throw Error("Syntax error, unrecognized expression: "+e)
In practice, when triggered deep inside some third party javascript that generates CSS selectors programmatically, this results in mildly helpful errors like this:
The only helpful part of this error message is that it actually contains the CSS selector used.
On the confusing side, it looks like an error that might've come from the JS engine of firefox itself, does not mention at all that it's upset about an invalid CSS selector, contains no stacktrace, can't be breakpointed on and when trying to approach it with firebug will be thrown often when trying to step into code that's many layers earlier in the call stack.
A simple change of the error message would make it much more helpful and less confusing:
throw Error("CSS selector syntax error, unrecognized expression: "+e)
Issue reported for jQuery 1.10.2