-
Notifications
You must be signed in to change notification settings - Fork 693
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
[css-syntax-3] Should declarations interleaved by an invalid rule be separated? #11271
Labels
Comments
Browsers also do not split declarations separated by an invalid at-rule: const sheet = new CSSStyleSheet
sheet.insertRule(`
style {
color: green;
@media;
color: red;
}
`)
sheet.cssRules[0].cssText; // style { color: red; } Whereas this is required by the current text:
So I guess it should be:
|
cdoublev
added a commit
to cdoublev/css
that referenced
this issue
Dec 19, 2024
Declarations are no longer hoisted or wrapped in a style rule. Some problem remains... 1. @font-feature-values, @function, @page, can also have declarations interleaved with rules, but CSSNestedDeclarations is currently associated to style properties. (w3c/csswg-drafts#11272) 2. "}" should be ignored in a "style" attribute value (a declaration block) but the algorithm has been replaced with the same algorithm than for a block of rules and declarations. (w3c/csswg-drafts#11113) 3. The current text wants declarations interleaved by an invalid at-rule or an invalid (qualified) rule error to be separated, but the reason is not stated and no browser does this. (w3c/csswg-drafts#11271) 4. The current text clearly has some other minor typos and is not clear about whether rules and declaration, or only rules, should be returned. (w3c/csswg-drafts#11017)
cdoublev
added a commit
to cdoublev/css
that referenced
this issue
Dec 19, 2024
Declarations are no longer hoisted or wrapped in a style rule. Some problem remains... 1. @font-feature-values, @function, @page, can also have declarations interleaved with rules, but CSSNestedDeclarations is currently associated to style properties. (w3c/csswg-drafts#11272) 2. "}" should be ignored in a "style" attribute value (a declaration block) but the algorithm has been replaced with the same algorithm than for a block of rules and declarations. (w3c/csswg-drafts#11113) 3. The current text wants declarations interleaved by an invalid at-rule or an invalid (qualified) rule error to be separated, but the reason is not stated and no browser does this. (w3c/csswg-drafts#11271) 4. The current text clearly has some other minor typos and is not clear about whether rules and declaration, or only rules, should be returned. (w3c/csswg-drafts#11017)
cdoublev
added a commit
to cdoublev/css
that referenced
this issue
Dec 19, 2024
Declarations are no longer hoisted or wrapped in a style rule. Some problem remains... 1. @font-feature-values, @function, @page, can also have declarations interleaved with rules, but CSSNestedDeclarations is currently associated to style properties. (w3c/csswg-drafts#11272) 2. "}" should be ignored in a "style" attribute value (a declaration block) but the algorithm has been replaced with the same algorithm than for a block of rules and declarations. (w3c/csswg-drafts#11113) 3. The current text wants declarations interleaved by an invalid at-rule or an invalid (qualified) rule error to be separated, but the reason is not stated and no browser does this. (w3c/csswg-drafts#11271) 4. The current text clearly has some other minor typos and is not clear about whether rules and declaration, or only rules, should be returned. (w3c/csswg-drafts#11017)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a rule is interleaved between declarations and triggers an "invalid rule error", the spec splits the declarations:
An invalid rule error is produced in a nested context from any list of tokens that:
:
}
and;
{}
-blockExamples:
{}
,. {}
,div: hover {}
,undeclared-ns|* {}
.If I am not mistaken, this intentionally takes space for future selector syntaxes. #8738 (comment) touches on that.
It might be useful to add a note, since that is not what the current version of Chrome and FF does:
There does not seem to be any corresponding test on WPT.
The text was updated successfully, but these errors were encountered: