[csswg-drafts] [cssom][css-nesting] Error behavior for insertRule with declaration blocks. (#10520)

andruud has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom][css-nesting] Error behavior for insertRule with declaration blocks. ==
In https://github.com/w3c/csswg-drafts/issues/10234 we resolved to give `insertRule` the ability to parse and insert declaration blocks (as `CSSNestingDeclarations` 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 `CSSNestingDeclarations` 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.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10520 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 2 July 2024 14:44:19 UTC