Skip to content

[Meta][Editorial] Define bags of CSS properties to be referenced by allowlists #9453

Open
@LeaVerou

Description

@LeaVerou

We are starting to have a fair number of CSS constructs (mostly pseudo-elements, but also pseudo-classes and at-rules) that accept restricted sets of properties, defined ad hoc:

Name Type Allowlist Defined in
Link history pseudo-classes (:link and :visited) pseudo-class Up to the UA selectors
::first-line pseudo-element defined inline css-pseudo
First letter pseudo-elements (::first-letter, ::prefix, ::postfix) pseudo-element defined inline css-pseudo
Highlight pseudo-elements (::selection, ::target-text, ::grammar-error, ::spelling-error) pseudo-element defined inline css-pseudo
::highlight() pseudo-element Same as highlight pseudo-elements css-pseudo
::marker pseudo-element defined inline css-lists
::placeholder pseudo-element same as ::first-line css-pseudo
::tooltip pseudo-element Not yet defined N/A
::cue pseudo-element defined inline WebVTT
@try at-rule accepts inset, margin, border, padding, sizing, box alignment, properties css-anchor-position
@page at-rule page properties and a margin rule accepts page margin properties. Both bags contain nested property bags. Nit: some of them refer to CSS2. css-page
Rules in @keyframes at-rule animatable properties, which are properties whose Animation type is not animatable css-animations

It may be useful to distill the intent behind each of these and create "sets" of properties that we can refer to (maybe in the CSS Indexes document?), so we don't have to update several locations when we add a new property, and especially so that non-CSSWG specs have to maintain lists of CSS properties, which is bound to get out of date. As you can see from the table above, this is already happening to some degree, with some allowlists referring to other allowlists. However, this is still rather ad hoc, and there are still multiple places to update every time we add a new property.

There are several advantages to this:

  • Less error-prone, easier to update one place when a new property is added, rather than having to remember every single allowlist in CSS
  • Encourages more alignment across different allowlists
  • Easier to compile new allowlists
  • Easier for authors to learn specific sets, rather than each pseudo having its own ad hoc allowlist.

Of course the question then becomes: what should the bags be?
To answer this, we need data. Once we have consensus to pursue this, someone should compile a table of all existing allowlists, so that the underlying concepts can emerge (e.g. cannot affect layout, etc), and we can take it from there.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Wednesday morning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions