[csswg-drafts] Clarifications on ignored declarations (#7428)

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

== Clarifications on ignored declarations ==
Would it be possible to clarify wordings regarding *ignored* declarations, please?

Specifications defining CSS rules that accept declarations in their block value use *accepts*, *contains*, and *can only contain*, followed by a designation of a set of properties/descriptors. If I am not mistaken, a declaration for a property or descriptor that is not *accepted* is ignored, and a rule or rule block value that does not *contain* a property or descriptor should ignore its declaration.

I believe that CSS Syntax provides a "general principle" for implementations to handle invalid items, which is to ignore them. But from reading [this issue](https://github.com/w3c/csswg-drafts/issues/5109) related to `@scroll-timeline`, *contains* and *can only contains* seems to imply a sensitive difference regarding forward compatibility. If I understand this matter correctly, these wordings should not imply that a declaration which cannot be contained in the CSS rule, makes this rule invalid, as with *can only contain*. Note that there are other specifications than Scroll Animations that currently use this wording (see references below), and do not clarify explicitly that declarations for other properties/descriptors should be ignored.

In this issue, I also demonstrate the difference in how Chrome and Firefox interprets these wordings regarding how these declarations are exposed by CSSOM. The wordings in CSS Counter Styles and CSS Fonts seem to indicate that it should not be exposed. The output in Firefox would therefore be the expected one.

I think a CSS author would be confused to be able to declare a property via `CSSStyleDeclaration` but to realize that it is ignored. But in this issue about [keyframe rules](https://github.com/w3c/csswg-drafts/issues/2736), I think that a reason for exposing a non-animatable property is provided. If I understood the comments in this issue correctly, all non-animatable properties are ignored, not just the properties defined in CSS Animations.

<details>
  <summary>Wording references</summary>

  - [CSS Animation 1] for a keyframe rule
    - *The `<declaration-list>` inside of `<keyframe-block>` **accepts** any CSS property except those defined in this specification*
    - *The `<keyframe-block>` **contains** properties and values. The properties defined by this specification **are ignored** in these rules, with the exception of `animation-timing-function`*
  - [CSS Color 5] for `@color-profile`
    - *The `@color-profile` rule **accepts** the descriptors defined in this specification.*
  - [CSS Counter Styles 3] for `@counter-style`
    - *Any descriptors that are not recognized or implemented by a given user agent, or whose value does not match the grammars given here or in a future version of this specification, **must be ignored** in their entirety; they do not make the `@counter-style` rule invalid.*
  - [CSS Fonts 4] for `@font-face`
    - *The `@font-face` rule **accepts** the descriptors defined in this specification.*
    - *Like properties in a declaration block, declarations of any descriptors that are not supported by the user agent **must be ignored**.*
  - [CSS Fonts 4] for `@font-feature-values`
    - *The `@font-feature-values` block **accepts** `<declaration-list>` as its contents; these list items are either at-rules named by one of the `<font-feature-value-type>` at-keyword tokens, or the `font-display` descriptor.*
  - [CSS Fonts 4] for `@font-palette-values`
    - *The `@font-palette-values` rule **accepts** the descriptors defined in this specification.*
    - *Like properties in a declaration block, declarations of any descriptors that are not supported by the user agent **must be ignored**.*
  - [CSS Page 3] for `@page`
    - *The `@page` rule **can only contain** page properties and margin at-rules.*
  - [CSS Page 3] for a margin rule
    - *The margin at-rules **can only contain** page-margin properties.*
  - [Scroll Animations 1] for `@scroll-timeline`
    - *The `<declaration-list>` inside of `@scroll-timeline` rule **can only contain** the descriptors defined in this section.*

  `@viewport` in CSS Device Adaptation has not been taken into account because this specification is going to be [rewrited](https://github.com/w3c/csswg-drafts/issues/4766).
</details>

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


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

Received on Wednesday, 29 June 2022 13:35:24 UTC