Opened 10 years ago
Closed 10 years ago
#12292 closed bug (fixed)
Invalid selectors can cause a subsequent valid selector not to work
Reported by: | 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?)
Change History (5)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
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 10 years ago by
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 10 years ago by
Component: | unfiled → selector |
---|---|
Milestone: | None → 1.8.1 |
Priority: | undecided → blocker |
Status: | new → open |
comment:5 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
This is also fixed by https://github.com/jquery/jquery/commit/b2698928bbdc1b247cb6de28e9b2624ec6b56667
Here is a fiddle to demonstrate: http://jsfiddle.net/mMCCd/5/