[css-syntax-3] Should declarations interleaved by an invalid rule be separated?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- css
- Domain
- documentation, testing
Research direction
Start with the CSS Syntax 3 “consume a block’s contents” section and the linked CSSWG discussion to determine whether the declaration-splitting behavior is intentional. Then compare the stated behavior with css/css-nesting/nested-declarations-cssom.html in WPT; done means the specification explains the behavior and a corresponding test covers the examples.
Written by the indexing model from the issue text.
Description
When a rule is interleaved between declarations and triggers an "invalid rule error", the spec splits the declarations:
- If an invalid rule error was returned
Ifdeclsis not empty, appenddeclstorules, and setdeclsto a fresh empty list of declarations.
An invalid rule error is produced in a nested context from any list of tokens that:
- is not a valid rule or declaration in the context
- is not an invalid at-rule in the context (it does not start with an at-keyword)
- does not start with a dashed identifier followed by
: - does not include a non nested "stop token":
}and; - ends with a
{}-block
Examples: {}, . {}, div: hover {}, undeclared-ns|* {}.
If I am not mistaken, this intentionally takes space for future selector syntaxes. https://github.com/w3c/csswg-drafts/issues/8738#issuecomment-1747640413 touches on that.
It might be useful to add a note, since that is not what the current version of Chrome and FF does:
const sheet = new CSSStyleSheet
sheet.insertRule(`
style {
color: green;
. {}
color: orange;
undeclared-ns|style {}
color: red;
}
`)
sheet.cssRules[0].cssText; // style { color: red; }
There does not seem to be any corresponding test on WPT.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 24
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from w3c/csswg-drafts
-
Agenda+ css-sizing-4 css-values-5
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
w3c/csswg-drafts#14502 · 1 reaction ·
-
css-values-5 editorial Needs Edits
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
w3c/csswg-drafts#14498 · 2 comments ·
-
css-overflow-4 topic: line-clamp
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
w3c/csswg-drafts#14485 · 1 comment ·
-
Administrative Tracker css-values-4
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
w3c/csswg-drafts#14482 · 4 comments · 1 reaction ·
-
css-values-5 Needs Edits
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
w3c/csswg-drafts#14466 ·
All issues in w3c/csswg-drafts
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bancolombia/sentinel#22 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
objectionary/hone-maven-plugin#1061 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
redhat-developer/rhdh-plugins#4887 · 2 comments ·