Re: [csswg-drafts] [css-cascade-5] Cascade Layers need CSSOM support (#6576)

This is not entirely trivial. Since we have two types of `@layer` rules, the empty statement and the block rule, do we want the same interface for both of them, or different interfaces?

I don't have a strong preference. Just putting the options here for discussion.

---

If we use different interfaces, the following seems pretty straightforward:

```idl
[Exposed=Window]
interface CSSLayerStatementRule : CSSRule {
  readonly attribute CSSOMString names;
};

[Exposed=Window]
interface CSSLayerBlockRule : CSSGroupingRule {
  readonly attribute CSSOMString name; // empty string for anonymous layer
};
```

---

If we use the same interface, it would probably be like

```idl
[Exposed=Window]
interface CSSLayerRule : CSSGroupingRule {
  readonly attribute CSSOMString name;
  readonly attribute boolean isEmptyStatement;

  unsigned long insertRule(CSSOMString rule, optional unsigned long index = 0); // Is this the correct syntax for override?
};
```

We need to override CSSGroupingRule.insertRule() so that it throws an exception when called on empty statements.

-- 
GitHub Notification of comment by xiaochengh
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6576#issuecomment-912716575 using your GitHub account


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

Received on Friday, 3 September 2021 18:05:22 UTC