Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Selector: Remove "#" exception for identifier tokens
Port Sizzle test change from: jquery/sizzle@f204a61 (cherry-picked from 86e62d8)
- Loading branch information
41f522a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Half web broken down, compatibility with older versions has to be Number 1 rule.
41f522a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next time, learn about backwords compatibility.
41f522a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is backwards compatible, see #2824 (comment). Although I agree that, if it is being tested, it should be mentioned in the changelog.
41f522a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
41f522a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
41f522a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
41f522a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
41f522a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
41f522a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
41f522a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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