Re: [csswg-drafts] [css-cascade-5] Do we need an API that lists the cascade layers in a tree scope? (#7015)

I would hesitate using "just" there, but yes: I'd use this to write ["third party" devtools](https://polypane.app/blog/polypane-8-better-elements-inspector-new-syncing-features-chromium-98-and-more/#cascade-layer-support), which I've currently done by keeping track of all Cascade layer occurrences and building a tree manually. This is less performant than a native API could provide.

From the CSSStyleSheet API you can "easily" deduct which CSSRule gets precedent by calculating and comparing the specificity of selectors combined with their natural order. Cascade Layers makes this no longer possible, yet between two layer declarations there is no way to tell which takes precedent without (re)traversing the entire set of rules available. An API that provides this functionality seems like a natural extension of the existing CSSOM APIs.

-- 
GitHub Notification of comment by Kilian
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7015#issuecomment-1031568052 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 7 February 2022 15:07:08 UTC