Skip to content
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

Comments at token boundaries break selectors (false positive) #236

squidfunk opened this issue May 3, 2019 · 0 comments


None yet
1 participant
Copy link

commented May 3, 2019

When encountering /* in the token stream, the tokenizer algorithm described in Syntax Level 3 states:

If the next input code point is U+002A ASTERISK (), consume it and all following code points up to and including the first U+002A ASTERISK () followed by a U+002F SOLIDUS (/), or up to an EOF code point. Then consume a token and return it.

Furthermore, later on:

The tokenizer described in this specification does not produce tokens for comments, or otherwise preserve them in any way. Implementations may preserve the contents of comments and their location in the token stream. If they do, this preserved information must have no effect on the parsing step.

This means that the tokenizer must effectively ignore comments, or, if it emits tokens for comments, ignore them during parsing. If comments occur at token boundaries, they should have absolutely no effect. This will work in every major browser, but won't validate:

./**/foo/**/:/**/hover {}

This will validate:

.foo/**/:hover {}

Note that for both examples, all comments are located at token boundaries. The tokenizer must parse it as:

[DELIM "."] [IDENT "foo"] [COLON] [IDENT "hover"] [WHITESPACE]...

I know that this might seem very pedantic, and I totally understand if this issue goes too far, so just consider this an FYI if somebody encounters this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.