Re: [csswg-drafts] [cssom] Properties that allow access to parsed-but-invalid syntactic constructs (declarations, rules, etc) as a low-fi way to make polyfills easier (#13186)

In the context of the polyfills I have worked on (anchor positioning and popover), I think the proposal in this issue would potentially reduce the complexity of a small part of the code, but wouldn't address some of the larger issues that @bramus's proposal covers. 

If I understand the proposal correctly, the author would still need to start at the Stylesheet and then discover what rules apply to an element. It could be useful to be able to reverse that, and return all declarations that apply to a given element. This is already exposed internally for dev tools, but I don't think it's exposed for authors. I could imagine this could be an array sorted in cascade order, so that the author can easily determine what the cascaded value would be if a value were not invalid. 

This would probably be most useful if it were coupled with a selector that could select elements based on CSS declarations, for instance selecting all elements that have `position-area` rules, even if that is not supported, or all elements that have `anchor()` in any value. Given the prior art of style queries, I'm guessing that's not straightforward. Perhaps it could be exposed with a `document.queryProperty()` call and not exposed in CSS?

So, it would be useful to have access to the invalid values, but I think it would need to be paired with some patterns for accessing that where it is needed. 

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


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

Received on Monday, 19 January 2026 15:07:28 UTC