CSSPseudoElement.selectorText
- Category
- JavaScript
- Type
- New or changed feature
- Status
- Proposed (Chrome Proposed)
- Intent stage
- None
WPT details: https://wpt.fyi/results/css/css-pseudo/CSSPseudoElement-selectorText.html
Summary
CSSPseudoElement is a javascript api that allows some limited interactions with pseudo elements from script. This feature adds a minor improvement, namely selectorText property, that returns the string that could be used to select this pseudo element from CSS.
Motivation
In order to disambiguate pseudo elements (in cases like view transition) it's important that we include more than the base type of the pseudo element, but include the arguments which would be a part of the selector text (e.g. type is ::view-transition-group, but selectorText is ::view-transition-group(foo))
Standards & signals
- Specification: https://drafts.csswg.org/css-pseudo-4/#dom-csspseudoelement-selectortext
- Firefox: No signal
- Safari: No signal
- Web developers: No signals
- Tracking bug: https://issues.chromium.org/567978984
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=css%2Fcss-pseudo%2FCSSPseudoElement-selectorText
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+CSSPseudoElement.selectorText
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=CSSPseudoElement.selectorText
- Baseline status: https://webstatus.dev/?q=CSSPseudoElement.selectorText
Explainers: https://github.com/vmpstr/htmldemos/blob/master/csspseudo/README.md