-
Notifications
You must be signed in to change notification settings - Fork 940
Selector: Allow whitespace after hex escapes in CSS identifiers #450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
timmywil
left a comment
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 can't say I fully understand the unescaping, but what I can gleam makes sense. If the tests pass, I'm down 👍
|
Remember to port the new tests to jQuery as well. |
mgol
left a comment
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.
Regex changes in source look good to me according to the linked token diagram. I have a few questions.
| var high = "0x" + escaped - 0x10000; | ||
|
|
||
| // NaN means non-codepoint | ||
| // Support: Firefox<24 |
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.
Is that old Firefox workaround no longer needed considering that Sizzle doesn't drop old browsers?
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.
No, it's just that the new code doesn't encounter that bug because high is not used unless nonHex is falsy (i.e., because we're replacing a nonempty hexadecimal escape).
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.
@gibson042 Interesting. Was the NaN check for high even needed before since escapedWhitespace was checked as a fallback anyway (as far as I understand the previous logic)?
mgol
left a comment
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.
One question but LGTM anyway.
test/unit/selector.js
Outdated
| broken( "Broken Selector", "," ); | ||
| broken( "Broken Selector", ",a" ); | ||
| broken( "Broken Selector", "a," ); | ||
| broken( "Identifer with bad escape", "foo\\\fbaz" ); |
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.
There's a typo here:
| broken( "Identifer with bad escape", "foo\\\fbaz" ); | |
| broken( "Identifier with bad escape", "foo\\\fbaz" ); |
|
I incorporated this PR into jquery/jquery#4395. Of course, this would still be good to land in Sizzle so that we can release the fix in jQuery 3.4.2. |
|
One of the added tests fails in Firefox 3.6: #454 |
Ref jquery/jquery#4424