Centralize definition for handling multiple descriptor declarations of the same name
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- PR merge metrics
- PR metrics pending
Description
(Follow-up to https://github.com/w3c/csswg-drafts/issues/12977#issuecomment-3419932394.)
When there are multiple declarations of the same descriptor, the declaration with the greatest cascading order, or the last one if they do not cascade, always wins.
The idea is therefore to establish a term to which the definitions of these rules accepting descriptors can refer, unless they define a different handling.
This default handling is clearly defined for @counter-style, @font-face, @font-palette-values, with a prose similar to this:
When a given descriptor occurs multiple times, only the last specified valid value is used; all prior values for that descriptor must be ignored.
For declarations in rules nested in @font-feature-values, it is basically equivalent.
It is unspecified for @font-feature-values (which only accepts font-display as a descriptor, which is debated in #2973), @color-profile, @position-try, @property, @view-transition.
If I am not mistaken, @page and margin rules are the only at-rules whose descriptor declarations are defined as cascading: the one with the greatest cascading order wins.
For @function and @mixin, I am not sure but from testing in Chrome, the last one seems to win.
A while ago, I suggested (#9821) to always apply the specified order at the syntax level. But I do not think I considered the idea that a rule might need to define "the first declaration wins".
@SebastianZ
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the descriptor-handling definitions linked for @counter-style, @font-face, @font-palette-values, @font-feature-values, @color-profile, @position-try, @property, and @view-transition. Determine shared terminology and whether @page, @function, and @mixin need exceptions; done means the affected specifications consistently reference a centralized rule with explicit exceptions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100