v160 · javascript · cssom
type vs selectorText lab
Feed any pseudo-element string to element.pseudo() and compare the two strings the returned CSSPseudoElement gives back: type is only the base name ("::view-transition-group"), selectorText is the full, normalized, round-trippable selector ("::view-transition-group(hero)"). Legacy :before normalizes to ::before; whitespace inside the parentheses is dropped; identifiers that need escaping come back escaped.
selectorText is gated by the Blink runtime feature CSSPseudoElementSelectorText (status experimental, default-on target Chrome 160). To run it: open chrome://flags/#enable-experimental-web-platform-features, set it to Enabled and relaunch — or launch Chrome/Canary with --enable-blink-features=CSSPseudoElementSelectorText, or --enable-features=CSSPseudoElementSelectorText (its Finch name), or --enable-experimental-web-platform-features. ::scroll-button() rows additionally need CSSPseudoElementScrollButton (also experimental, also covered by the experimental-features flag).
Originating elements
#subject
has ::before and ::after
#list li
- styled ::marker
#scroller
<html>
originates every ::view-transition-* pseudo-element
Presets
Or type your own
| call | type | selectorText | spec expects |
|---|---|---|---|
| no calls yet | |||
what the lab proves
const g = document.documentElement.pseudo("::view-transition-group(hero)");
g.type // "::view-transition-group" — kind only
g.selectorText // "::view-transition-group(hero)" — kind + argument
el.pseudo(":before").selectorText // "::before" (legacy colon normalized)
scroller.pseudo("::scroll-button( inline-start )").selectorText
// "::scroll-button(inline-start)"
html.pseudo("::view-transition-group(\\31 st-card)").selectorText
// "::view-transition-group(\\31 st-card)" (escaped ident)
The “spec expects” column is copied from the explainer’s table and Chromium’s serializer (SerializeIdentifier for view-transition names, keywords verbatim for scroll buttons). It is a reference, never substituted for the browser’s answer: if selectorText is not exposed the selectorText column says so.