- From: Guillaume via GitHub <sysbot+gh@w3.org>
- Date: Mon, 20 Mar 2023 13:55:55 +0000
- To: public-css-archive@w3.org
cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-syntax-3][cssom-1] Accept `<relative-selector-list>` in top-level style rules == I suspect this has already been discussed before but I cannot find any trace of it. If I am not mistaken, `&` is valid in the prelude of a top-level style rule and represents `:root`. So it is theoretically valid to use a `<relative-selector-list>` like `> body`. Would it be acceptable to define the prelude of top-level style rules with `<relative-selector-list>` instead of `<selector-list>`? If so, changes would be required in CSS Syntax 3 (*8.1. Defining Block Contents: the `<declaration-list>`, `<rule-list>`, and `<stylesheet>` productions*) and CSSOM (*parse a selector* and *serialize a selector*). --- Obviously, that does not seem usefull. I am actually interested in having a single style rule definition to simplify the representation of CSS rule definitions. The block value of `@scope` is defined with `<stylesheet>`, which accepts all CSS rules except those excluded by `@scope` or restricted to a specific context (eg. keyframe, margin, etc). For all other CSS rules whose block value is `<stylesheet>`, this is equivalent to accepting all top-level rules excluding `@import` and `@namespace`. But the prelude of (scoped) style rules in `@scope` is defined with `<relative-selector-list>` (like nested style rules) therefore valid rules in `@scope` need to be explicitly defined rather than defining a list of excluded rules, which is otherwise matching the intent of the formal definition of `<stylesheet>` in CSS Syntax 3 (emphasize added): > For rules that use `<stylesheet>`, all rules are allowed by default, but the spec for **the rule may define what types of rules are invalid inside the rule.** > the `<stylesheet>` production represents a list of rules. It is identical to <rule-list>, except that blocks using it default to accepting all rules that aren’t otherwise limited to a particular context. https://drafts.csswg.org/css-syntax-3/#declaration-rule-list Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8618 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 20 March 2023 13:55:57 UTC