Skip to content
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

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

Open
andruud opened this issue Jul 2, 2024 · 0 comments
Open

Comments

@andruud
Copy link
Member

andruud commented Jul 2, 2024

In #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant