[csswg-drafts] [Meta][Editorial] Define bags of CSS properties to be referenced by allowlists (#9453)

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

== [Meta][Editorial] Define bags of CSS properties to be referenced by allowlists ==
We are starting to have a fair number of pseudo-classes and pseudo-elements that accept restricted sets of properties:

1. [Link history pseudo-classes](https://drafts.csswg.org/selectors/#link) (`:link` and `:visited`)
2. [`::first-line`](https://drafts.csswg.org/css-pseudo/#selectordef-first-line)
3. [Highlight pseudo-elements](https://drafts.csswg.org/css-pseudo/#highlight-pseudos) (`::selection`, `::target-text`, `::grammar-error`, `::spelling-error`)
4. [`::highlight()`](https://drafts.csswg.org/css-highlight-api/#custom-highlight-pseudo)
5. [`::marker`](https://drafts.csswg.org/css-pseudo/#marker-pseudo)
6. [`::placeholder`](https://drafts.csswg.org/css-pseudo/#placeholder-pseudo)
7. [`::tooltip`](https://github.com/w3c/csswg-drafts/issues/9447)

Right now, the allowlists for each of these are defined ad hoc:
1. For `:link` and `:visited` they are not defined in the spec at all, it seems to be [up to UAs](https://github.com/w3c/csswg-drafts/issues/9447), which is an interop problem in itself 
2. `::first-line` [defines its allowlist in css-pseudo](https://drafts.csswg.org/css-pseudo/#first-line-styling)
3. Properties allowed on highlight pseudo-elements defined in [css-pseudo](https://drafts.csswg.org/css-pseudo/#highlight-styling)
4. Properties allowed on `::highlight()` [points to the same list as highlight pseudo-elements, in css-pseudo](https://drafts.csswg.org/css-highlight-api/#applicable-properties).
5. The list for `::marker` is defined in [css-lists](https://drafts.csswg.org/css-lists-3/#marker-properties)
6. `::placeholder` [refers to `::first-line`’s allowlist](https://drafts.csswg.org/css-pseudo/#placeholder-pseudo:~:text=All%20properties%20that%20apply%20to%20the%20%3A%3Afirst%2Dline%20pseudo%2Delement%20also%20apply%20to%20the%20%3A%3Aplaceholder%20pseudo%2Delement.)

It may be useful to create "sets" of properties that we can refer to (maybe in the [CSS Indexes document](https://drafts.csswg.org/indexes/)?), so we don't have to update several locations when we add a new property. As you can see from the list 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.

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


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

Received on Tuesday, 10 October 2023 17:58:27 UTC