Permalink
Browse files

Selector: Remove "#" exception for identifier tokens

Port Sizzle test change from:
jquery/sizzle@f204a61

(cherry-picked from 86e62d8)
  • Loading branch information...
mgol committed Jun 30, 2014
1 parent b3edc61 commit 41f522ace1518f7f6f22f2e227350b0bdf78e62b
Showing with 2 additions and 2 deletions.
  1. +2 −2 test/unit/selector.js
View
@@ -166,8 +166,8 @@ test("attributes", function() {
t( "Attribute Equals Number", "#qunit-fixture li[tabIndex=-1]", ["foodWithNegativeTabIndex"] );
document.getElementById("anchor2").href = "#2";
- t( "href Attribute", "p a[href^=#]", ["anchor2"] );
- t( "href Attribute", "p a[href*=#]", ["simon1", "anchor2"] );
+ t( "href Attribute", "p a[href^='#']", ["anchor2"] );
+ t( "href Attribute", "p a[href*='#']", ["simon1", "anchor2"] );
t( "for Attribute", "form label[for]", ["label-for"] );
t( "for Attribute in form", "#form [for=action]", ["label-for"] );

10 comments on commit 41f522a

@Basilakis

This comment has been minimized.

Show comment
Hide comment
@Basilakis

Basilakis Apr 13, 2016

Half web broken down, compatibility with older versions has to be Number 1 rule.

Half web broken down, compatibility with older versions has to be Number 1 rule.

@Basilakis

This comment has been minimized.

Show comment
Hide comment
@Basilakis

Basilakis Apr 13, 2016

Next time, learn about backwords compatibility.

Next time, learn about backwords compatibility.

@FagnerMartinsBrack

This comment has been minimized.

Show comment
Hide comment
@FagnerMartinsBrack

FagnerMartinsBrack Apr 13, 2016

It is backwards compatible, see #2824 (comment). Although I agree that, if it is being tested, it should be mentioned in the changelog.

It is backwards compatible, see #2824 (comment). Although I agree that, if it is being tested, it should be mentioned in the changelog.

@timmywil

This comment has been minimized.

Show comment
Hide comment
@timmywil

timmywil Apr 13, 2016

Member

It is in the changelog, but was not given special attention in the blog post. It was an invalid selector that unfortunately got used. The good news is that by adding the quotes, you will not only be using a valid selector, but you'll make it faster.

Member

timmywil replied Apr 13, 2016

It is in the changelog, but was not given special attention in the blog post. It was an invalid selector that unfortunately got used. The good news is that by adding the quotes, you will not only be using a valid selector, but you'll make it faster.

@georgestephanis

This comment has been minimized.

Show comment
Hide comment
@georgestephanis

georgestephanis Apr 13, 2016

I believe running the following command against your codebase will turn up instances of the old inaccurate selector, that you can correct to make your code work correctly with jQuery 1.12 --

ack "\[href.?=#"

(the .? is to catch either *= and ^= -- the latter of which I can't seem to get working without the . wildcard)

Hopefully this should help some folks find the bit in the code that they're using that is conflicting with this changeset.

I believe running the following command against your codebase will turn up instances of the old inaccurate selector, that you can correct to make your code work correctly with jQuery 1.12 --

ack "\[href.?=#"

(the .? is to catch either *= and ^= -- the latter of which I can't seem to get working without the . wildcard)

Hopefully this should help some folks find the bit in the code that they're using that is conflicting with this changeset.

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Apr 13, 2016

Member

We warn about this in jQuery Migrate, but cannot auto-fix it because a regex cannot parse the selector well enough to fix the invalid cases without also breaking valid ones.

AFAICT this seems to be breaking a couple of common selector expressions that are either in a relatively popular plugin or copy-pastaed from StackOverflow. jQuery Migrate should pinpoint them for you, including a stack trace. If you find that it is coming from a plugin you are using, look for an update and if there isn't one please submit a pull request to the author to fix it.

Member

dmethvin replied Apr 13, 2016

We warn about this in jQuery Migrate, but cannot auto-fix it because a regex cannot parse the selector well enough to fix the invalid cases without also breaking valid ones.

AFAICT this seems to be breaking a couple of common selector expressions that are either in a relatively popular plugin or copy-pastaed from StackOverflow. jQuery Migrate should pinpoint them for you, including a stack trace. If you find that it is coming from a plugin you are using, look for an update and if there isn't one please submit a pull request to the author to fix it.

@georgestephanis

This comment has been minimized.

Show comment
Hide comment
@georgestephanis

georgestephanis Apr 13, 2016

@dmethvin Yeah, there were several WordPress themes doing it the old incorrect way that didn't test against the betas, so yesterday when the 4.5 update shipped, breakage :( . We're trying to get the word out on our side and scan as many as we can and notify theme/plugin authors on our side, hopefully that'll be able to take some of the heat off y'all and get things running merrily for most users soon.

@dmethvin Yeah, there were several WordPress themes doing it the old incorrect way that didn't test against the betas, so yesterday when the 4.5 update shipped, breakage :( . We're trying to get the word out on our side and scan as many as we can and notify theme/plugin authors on our side, hopefully that'll be able to take some of the heat off y'all and get things running merrily for most users soon.

@emcniece

This comment has been minimized.

Show comment
Hide comment
@emcniece

emcniece Apr 13, 2016

This theme has over 87,000 sales and uses this selector in such a way that it breaks huge parts of the theme (namely image-related animation-y things). The problem is that while WordPress auto-updates, the theme does not - you have to enter your marketplace API credentials, and initiate the theme update manually... and you can't do that if you have modified the theme files.

It's gonna be a busy week!

This theme has over 87,000 sales and uses this selector in such a way that it breaks huge parts of the theme (namely image-related animation-y things). The problem is that while WordPress auto-updates, the theme does not - you have to enter your marketplace API credentials, and initiate the theme update manually... and you can't do that if you have modified the theme files.

It's gonna be a busy week!

@mgol

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Apr 13, 2016

Member

@emcniece Such problems are unfortunately inevitable from time to time. That's why we advise to pin jQuery versions and upgrade by yourself even though we now technically follow semver.

Member

mgol replied Apr 13, 2016

@emcniece Such problems are unfortunately inevitable from time to time. That's why we advise to pin jQuery versions and upgrade by yourself even though we now technically follow semver.

@geliyoo

This comment has been minimized.

Show comment
Hide comment
@geliyoo

geliyoo Apr 16, 2016

Hi i can fixed from my js file href problem with this code.
a[href=#]:not([href=#])
to
a[href=#]:not([href=#])

Can you check please if it possiblem fixed from jquery

Hi i can fixed from my js file href problem with this code.
a[href=#]:not([href=#])
to
a[href=#]:not([href=#])

Can you check please if it possiblem fixed from jquery

Please sign in to comment.