LibWeb/CSS: Support legacy selector aliases for pseudo-classes

These are replaced with the pseudo-class they are an alias of, during
parsing.
This commit is contained in:
Sam Atkins
2025-12-18 12:47:44 +00:00
committed by Jelle Raaijmakers
parent 36a9b653ae
commit 2b2e5a1db3
Notes: github-actions[bot] 2025-12-18 13:52:04 +00:00
3 changed files with 28 additions and 10 deletions

View File

@@ -199,9 +199,12 @@ The generated code provides these for each enum, using "foo" as an example:
This is a single JSON object, with selector pseudo-class names as keys and the values being objects with fields for the pseudo-class.
This generates `PseudoClass.h` and `PseudoClass.cpp`.
Each entry has a single required property, `argument`, which is a string containing the grammar for the pseudo-class's
function parameters - for identifier-style pseudo-classes it is left blank.
The grammar is taken directly from the spec.
Each entry has the following properties:
| Field | Required | Default | Description |
|----------------------|----------------------------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `argument` | Unless `legacy-alias-for` is specified | Nothing | A string containing the grammar for the pseudo-class's function parameters - for identifier-style pseudo-classes it is left blank. The grammar is taken directly from the spec. |
| `legacy-alias-for` | No | Nothing | Use to specify that this should be treated as a [legacy selector alias](https://drafts.csswg.org/selectors/#legacy-selector-alias) for the named pseudo-class. |
The generated code provides:
- A `PseudoClass` enum listing every pseudo-class name