← Back to release summary

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

Ecosystem

Explainers: https://github.com/vmpstr/htmldemos/blob/master/csspseudo/README.md

View on chromestatus.com