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 false positives for "never" in selector-attribute-quotes #4300
Comments
Mark as |
@thybzi Thanks for the suggestion. SGTM as there's precedent for this in Labelling as help wanted. You're welcome to submit a PR if you like. Most of the answers should already been in the |
selector-attribute-quotes
option (e.g. "only-required")
Revisiting this. It sounds like the
I've labelled the issue as ready to implement. Please consider contributing if you have time. There are steps on how to fix a bug in a rule in the Developer guide. |
Hey all, I gave a quick spin to the suggested proposal in #6571. I just wanted to clarify the expected behaviour - after implementing the logic enumerated by @jeddy3, some existing tests for the [href="te'st"] { }
[href='te"st'] { }
[href='te\'s\'t'] { }
[href="te\"s\"t"] { } Currently, the new implementation skips these; the current implementation of the rule flags a warning. To me, it seems like the rule shouldn't remove these quotes, since the resulting attribute value wouldn't be a valid identifier. Wanted to make sure that this wasn't necessarily a regression (since it does change the rule behaviour). If we agree, I can then write a few more tests to capture other behaviour and mark the PR as ready to review! |
SGTM, it seems safer not to remove the outer quotes if there are inner quotes (escaped or otherwise). |
so to me
can be processed and become
but
should remain untouched. |
Thanks for your patience everyone, have updated #6571 with what I believe is now the desired behaviour. |
We try avoid any unnecessary quotes in selectors, so we use
"selector-attribute-quotes": "never"
.But some selectors really require quotes to be valid.
And here is why:
According to the spec http://www.w3.org/TR/CSS2/selector.html#attribute-selectors:
Furthermore, according to the spec http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier:
And, according to the spec http://www.w3.org/TR/CSS2/syndata.html#strings:
A new option for
selector-attribute-quotes
(e.g. "only-required" or "only-necessary"), which would work like "never", but allow/require quotes when the correspondent part of selector:The text was updated successfully, but these errors were encountered: