w3c / w3c/csswg-drafts

Centralize definition for handling multiple descriptor declarations of the same name

Open
#12,979 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

unknown/future spec
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.