Implement Element.computedStyleMap()
Categories
(Core :: DOM: CSS Object Model, enhancement)
Tracking
()
People
(Reporter: fredw, Unassigned)
References
(Blocks 3 open bugs)
Details
(Keywords: dev-doc-needed, parity-chrome, parity-safari, Whiteboard: webcompat:risk-moderate )
Attachments
(1 obsolete file)
The specification is https://drafts.css-houdini.org/css-typed-om/#computed-stylepropertymapreadonly-objects
Note the following, which means this is different from https://searchfox.org/mozilla-central/rev/abbea4195b00e82af2ae9abaafc31e4b4ec4f8c0/layout/style/nsComputedDOMStyle.cpp#2385
The StylePropertyMapReadOnly returned by this method represents the actual computed values, not the resolved value concept used by Window.getComputedStyle(). It can thus return different values than Window.getComputedStyle() for some properties (such as width).
There are a couple of WPT tests relying on it:
https://searchfox.org/mozilla-central/search?q=computedStyleMap%28%29&path=testing%2Fweb-platform%2Ftests&case=false®exp=false
In particular, the following WPT tests from the CSS properties and values API rely on this API:
/css/css-properties-values-api/at-property-typedom.html
/css/css-properties-values-api/property-cascade.html
/css/css-properties-values-api/typedom.html
Updated•1 year ago
|
Reporter | ||
Comment 1•1 year ago
|
||
Checking a bit the spec, computedStyleMap()
returns its a StylePropertyMapReadOnly
where the values are CSSStyleValue
objects constructed by "reification" and with special serialization rules. So only implementing computedStyleMap()
would already require implementing a good chunk of the css-typed-om spec.
Reporter | ||
Comment 3•1 year ago
|
||
At the end, this may not be necessary for interop 2023 if we rewrite property-cascade.html (the typedom ones will still require this though). I opened https://github.com/web-platform-tests/interop/issues/588
Comment 4•1 year ago
|
||
This feature is no longer in draft and is already implemented by every other browser. We would be extremely helpful to have it available to list CSS variables applied to an element when you don't know the name of the variables ahead of time.
It's also been recommended by W3C members, here: https://github.com/w3c/csswg-drafts/issues/8398#issuecomment-1570264185
Comment hidden (offtopic) |
Comment hidden (offtopic) |
Comment hidden (offtopic) |
Comment hidden (offtopic) |
Comment hidden (offtopic) |
Comment hidden (offtopic) |
Comment hidden (off-topic) |
Updated•11 months ago
|
Comment 12•11 months ago
|
||
Lack of support for this is at least partly why we fail WPTs like https://wpt.fyi/results/css/css-color/system-color-compute.html
Updated•2 months ago
|
Description
•