csswg-drafts icon indicating copy to clipboard operation
csswg-drafts copied to clipboard

[cssom][css-nesting] Error behavior for insertRule with declaration blocks.

Open andruud opened this issue 1 month ago • 0 comments

In https://github.com/w3c/csswg-drafts/issues/10234 we resolved to give insertRule the ability to parse and insert declaration blocks (as CSSNestedDeclarations rules).

As of recent spec edits, insertRule is now set up to parse a declaration block (after the regular rule parsing), and throw an error when that declaration block is empty. https://drafts.csswg.org/cssom/#insert-a-css-rule, Step 4.

Is this behavior indeed what we want? @emilio points out that it's possibly weird that potentially-unknown-property:foo throws, but potentially-unknown-property: foo; color:red doesn't.

On the other hand, the following would lead to no CSSNestedDeclarations rule when parsed normally:

.a {
  .b { ... }
  potentially-unknown-property: foo;
}

Whereas this would:

.a {
  .b { ... }
  potentially-unknown-property: foo;
  color:red;
}

So probably the specified behavior isn't too bad, but I'd like to discuss to either get a stamp for this change, or to see if we can do better somehow.

andruud avatar Jul 02 '24 14:07 andruud