-
Notifications
You must be signed in to change notification settings - Fork 788
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
fix(get-selector): do not URL encode or token escape attribute selectors #3215
Conversation
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.
Need to also not escape when the full URL is used
function escapeAttribute(str) { | ||
return ( | ||
str | ||
// @see https://www.py4u.net/discuss/286669 |
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.
Where is this supposed to go? I get a 502 on this.
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.
Well it did go to a discussion about what values of an attribute string should be replaced. It was the only place I could find something. Would you happen to know of an official spec for that?
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.
Seems to be working again
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.
Would using CSS.escape()
or a ponyfil make more sense than a custom implementation here?
I looked at CSS.escape but it works like our I'd be fine replacing our |
When trying to get the selector for the images on #3109, the end result of the
getAttributeNameValue
would end up being URI encoded and token escaped.What that means is that instead of returning
[href$="1 Seater"]
(a valid CSS attribute selector) it would first URI encode it, which would turn into[href$="1%20Seater"]
, and then token escape it which would try to prevent the first character from being a number (an invalid CSS token) and escape it, resulting in[href$="\31 %20Seater"]
. This selector would not find anything in the document so:root
would be returned by default.Since attribute selectors can be strings and since we're wrapping the value in quotes, it wasn't necessary to do any escaping or encoding.
Closes issue: #3109