Intent to prototype and ship: :nth-child(An+B of <selector list>)

126 views
Skip to first unread message

Zach Hoffman

unread,
Mar 16, 2023, 4:15:23 PM3/16/23
to dev-pl...@mozilla.org
As of today, I intend to turn :nth-child(An+B of <selector list>) and :nth-last-child(An+B of <selector list>) on by default on all platforms. It has been developed behind the layout.css.nth-child-of.enabled preference. Status in other browsers is shipped.

Summary: Implement the selector list of :nth-child(An+B of <selector list>) and :nth-last-child(An+B of <selector list>) from the CSS Selectors 4 spec, which can be used like :nth-of-type(An+B) and :nth-last-of-type(An+B), except <selector list> can be any selector list, not only a type selector.

It's been enabled in Nightly for 2 weeks, see <https://bugzil.la/1819711>.

Bug: https://bugzil.la/nth-child-of
Bug to turn on by default: https://bugzil.la/1808229

Specification:
* https://drafts.csswg.org/selectors-4/#nth-child-pseudo
* https://drafts.csswg.org/selectors-4/#nth-last-child-pseudo

Standards Body: CSSWG (W3C)

Platform coverage: All

Preference: layout.css.nth-child-of.enabled

DevTools bug: N/A, existing DevTools support works fine. Adding autocompletion for selectors is tracked in <https://bugzil.la/1166963>, please speak up if you think something additional is needed.

Other browsers:
* Chromium: Shipped <https://groups.google.com/a/chromium.org/g/blink-dev/c/6zLouMDG4Eg> in M111

* Safari: Shipped in Safari 9 (2015!)

web-platform-tests:
* Matching tests in https://wpt.fyi/results/css/selectors
* Invalidation tests in https://wpt.fyi/results/css/selectors/invalidation
* Some supports() negative tests in https://wpt.fyi/results/css/css-conditional/js/CSS-supports-L4.html
* Bug for reftests in SVG: https://bugzil.la/1821258

-Zach
Reply all
Reply to author
Forward
0 new messages