Bug Tracker

Opened 9 years ago

Closed 9 years ago

#12292 closed bug (fixed)

Invalid selectors can cause a subsequent valid selector not to work

Reported by: [email protected] Owned by:
Priority: blocker Milestone: 1.8.1
Component: selector Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:


In jQuery 1.8.0 the (obviously invalid) code:


results in the error:

TypeError: groups is null (jquery.js Line 4664)

Then the next time you run a valid pseudoclass selector (eg ":first") you get the following error:

Error: Syntax error, unrecognized expression: unsupported pseudo: last (jquery.js Line 4512)

Selectors run after this appear to work normally.

There are two problems here:

Firstly any selector run after the offending ":first.not(.asd)" doesn't work.

Secondly, previous jquery versions allowed ":first.not(.foo)" to pass without an error. I came across this bug as the shopping cart software we use pulls the latest version from Google, and had the above invalid selector (obviously they mean ":not" rather than ".not" but never noticed). When 1.8.0 made it onto Google's servers certain things no longer worked across a range of sites (I'm not really blaming jQuery here, but there was a change in behaviour. Is it intended that an error of some sort be raised here?)

Change History (5)

comment:1 Changed 9 years ago by Richard Ward <[email protected]…>

Here is a fiddle to demonstrate: http://jsfiddle.net/mMCCd/5/

comment:2 Changed 9 years ago by Richard Ward <[email protected]…>

Id like to change the title of this bug to something like "Invalid selectors can cause a subsequent valid selector not to work" as the title I put doesn't really get across that this is causing problems, but I can't seem to change the title.

comment:3 Changed 9 years ago by ajpiano

Summary: Class selector after pseudo selector results in odd error reporting.Invalid selectors can cause a subsequent valid selector not to work

Title changed per OP request.

comment:4 Changed 9 years ago by dmethvin

Component: unfiledselector
Milestone: None1.8.1
Priority: undecidedblocker
Status: newopen

comment:5 Changed 9 years ago by timmywil

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.