Skip to content

Commit 91b9f11

Browse files
committed
[css-nesting-1] Add error-handling for inserting or setting selector on a nested style rule.
1 parent d629921 commit 91b9f11

2 files changed

Lines changed: 17 additions & 218 deletions

File tree

css-nesting-1/Overview.bs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,24 +1133,27 @@ must return the result of
11331133
invoking [=insert a CSS rule=] <var>rule</var>
11341134
into the [=CSSRule/child CSS rules=] at <var>index</var>.
11351135

1136+
11361137
The <dfn method for=CSSStyleRule>deleteRule(<var>index</var>)</dfn> method
11371138
must [=remove a CSS rule=] from the [=CSSRule/child CSS rules=] at <var>index</var>.
11381139

11391140
Note: Serialization of {{CSSStyleRule}} with nested rules
11401141
are already well-defined by [[CSSOM]],
11411142
via [=serialize a CSS rule=].
11421143

1143-
<div class=issue>
1144-
Whether we attach .cssRules to CSSStyleRule,
1145-
as described here,
1146-
or to CSSStyleDeclaration
1147-
(to be consistent with future work
1148-
allowing `style` attributes to have nested rules)
1149-
is still an open question.
1150-
1151-
Also, attaching it to .style
1152-
means existing code setting <code>rule.style=""</code>
1153-
and expecting
1154-
1155-
(<a href="https://github.com/w3c/csswg-drafts/issues/7850">Issue 7850</a>)
1156-
</div>
1144+
Note: The restriction on what a [=nested style rule's=]
1145+
selector can start with
1146+
counts as a "constraint imposed by CSS"
1147+
in step 5 of [=insert a CSS rule=]
1148+
(when invoked by anything that takes [=nested style rules=],
1149+
not just {{CSSStyleRule}} itself).
1150+
1151+
When setting {{CSSStyleRule/selectorText}},
1152+
if the {{CSSStyleRule}} is a [=nested style rule=],
1153+
and the returned group of selectors
1154+
starts with a selector
1155+
that starts with an ident or function token,
1156+
do nothing and return.
1157+
1158+
Issue: The above paragraph will be inlined into the CSSOM algo,
1159+
rather than monkey-patched.

css-nesting-1/proposals.md

Lines changed: 0 additions & 204 deletions
This file was deleted.

0 commit comments

Comments
 (0)