jwmcglynn / donner

Donner SVG, a modern C++20 SVG rendering library supporting the latest SVG2 and CSS3 standards
https://jwmcglynn.github.io/donner/
ISC License
13 stars 1 forks source link

CSS Selector Support #3

Closed jwmcglynn closed 3 months ago

jwmcglynn commented 1 year ago
jwmcglynn commented 1 year ago

Here's a good list of pseudo class selectors to initially support, from librsvg: https://gnome.pages.gitlab.gnome.org/librsvg/devel-docs/features.html#pseudo-classes

jwmcglynn commented 6 months ago

Pseudo-class selectors from https://www.w3.org/TR/selectors-4/

jwmcglynn commented 6 months ago

Initial pseudo-class selectors are in 4a51f7d9f79f7b33f8cb2f68ab35981a0844e32e

jwmcglynn commented 6 months ago

a2fac7fcc727398dc7f8b07d8dc6890c1f6ff08c adds support for these ones

jwmcglynn commented 6 months ago

Currently :nth-of-type(... [of S]?) only accepts a TypeSelector, it needs to be updated to parse a forgiving-selector-list. Added to the description.

Per the CSS spec:

The :nth-child(An+B [of S]? ) pseudo-class notation represents elements that are among An+Bth elements from the list composed of their inclusive siblings that match the selector list S, which is a  parsed as a forgiving selector list. If S is omitted, it defaults to |.

jwmcglynn commented 4 months ago

Initial support for :is(), :where(), :not() added in https://github.com/jwmcglynn/donner/commit/56b9b64982c661723c9dd6655614a53f65e927d9

jwmcglynn commented 4 months ago

Remaining work before closing out this task are :has() and :defined, and maybe :scope.

For :has(), support needs to be added for parsing a <forgiving-relative-selector-list>.

There's a long tail of other pseudo-classes, but most are only relevant once other features such as interactivity, animation, or localization are added.

jwmcglynn commented 3 months ago

:scope support added in 99ba003a669b9e62746b31235529cfd58abdf583

jwmcglynn commented 3 months ago

https://github.com/jwmcglynn/donner/commit/5a8bace904bf19e5c36043dbcff0ea9630c3abc7 adds support for :has()

jwmcglynn commented 3 months ago

https://github.com/jwmcglynn/donner/commit/16db844773dc831a876278756283c67b3a9c54b1 implements :defined