Bug Tracker


Ticket #12292 (closed bug: fixed)

Opened 21 months ago

Last modified 20 months ago

Invalid selectors can cause a subsequent valid selector not to work

Reported by: richard@… Owned by:
Priority: blocker Milestone: 1.8.1
Component: selector Version: 1.8.0
Keywords: Cc:
Blocking: Blocked by:


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

comment:1 Changed 21 months ago by Richard Ward <richard@…>

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

comment:2 Changed 21 months ago by Richard Ward <richard@…>

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 21 months ago by ajpiano

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

Title changed per OP request.

comment:4 Changed 20 months ago by dmethvin

  • Priority changed from undecided to blocker
  • Status changed from new to open
  • Component changed from unfiled to selector
  • Milestone changed from None to 1.8.1

comment:5 Changed 20 months ago by timmywil

  • Status changed from open to closed
  • Resolution set to fixed

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.