Skip to main content

Bug Tracker

Side navigation

#12292 closed bug (fixed)

Opened August 14, 2012 10:56AM UTC

Closed August 24, 2012 09:49PM UTC

Invalid selectors can cause a subsequent valid selector not to work

Reported by: richard@richard.ward.name Owned by:
Priority: blocker Milestone: 1.8.1
Component: selector Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:
Description

In jQuery 1.8.0 the (obviously invalid) code:

jQuery(":first.not(.foo)");

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?)

Attachments (0)
Change History (5)

Changed August 14, 2012 11:27AM UTC by Richard Ward <richard@richard.ward.name> comment:1

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

Changed August 14, 2012 02:08PM UTC by Richard Ward <richard@richard.ward.name> comment:2

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.

Changed August 14, 2012 02:12PM UTC by ajpiano comment:3

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.

Changed August 21, 2012 12:43AM UTC by dmethvin comment:4

component: unfiledselector
milestone: None1.8.1
priority: undecidedblocker
status: newopen

Changed August 24, 2012 09:49PM UTC by timmywil comment:5

resolution: → fixed
status: openclosed