Re: [csswg-drafts] [css-counter-styles] Clarify how @counter-style name lookup works with shadow DOM (#5693)

Here's a proposal based on [CSS-SCOPING-1](https://drafts.csswg.org/css-scoping/#shadow-names), and compatible with Firefox's behavior that a global `@counter-style` rule can be access within a shadow tree.

As specified in [CSS-SCOPING-1](https://drafts.csswg.org/css-scoping/#shadow-names):
- Each `@counter-style` rule defines a **tree-scoped name**
- Each counter style name reference defines a **tree-scoped reference**. This includes:
  * `system: extends` and `fallback` descriptors
  * `list-style-type` property
  * `counter()` and `counters()` functions in `content` property

To dereference a tree-scoped reference, we first look for names within the same tree scope; If there's no match, we recursively walk up to the parent tree scope and search until a matching name is found.

Note that the current spec of CSS-SCOPING-1 only searches the same tree scope, which makes @counter-style defined in the main document inaccessible from shadow trees.


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


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

Received on Tuesday, 1 December 2020 22:46:41 UTC