On a CSSStyleRule you can get the selectorText that returns the textual representation of the selector.
With CSS nesting, this value has become somewhat less useful as it doesn’t represent the full selector.
While an author can use script to compute the flattened selector by manually walking the .parentRule to the top and then doing the checks + replacements for &, it would be nice if this was built into the platform. That way, an author can directly use it in something like document.querySelectorAll.
I’m thinking of a property named flattenedSelectorText or fullSelectorText.
On a
CSSStyleRuleyou can get theselectorTextthat returns the textual representation of the selector.With CSS nesting, this value has become somewhat less useful as it doesn’t represent the full selector.
While an author can use script to compute the flattened selector by manually walking the
.parentRuleto the top and then doing the checks + replacements for&, it would be nice if this was built into the platform. That way, an author can directly use it in something likedocument.querySelectorAll.I’m thinking of a property named
flattenedSelectorTextorfullSelectorText.