W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2018

[csswg-drafts] [cssom] getComputedStyle()[--var] return a resolved value?

From: jonjohnjohnson via GitHub <sysbot+gh@w3.org>
Date: Sat, 24 Feb 2018 21:48:31 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-299975632-1519508909-sysbot+gh@w3.org>
jonjohnjohnson has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom] getComputedStyle()[--var] return a resolved value? ==
https://drafts.csswg.org/cssom/#resolved-values

If you have this...
```
el.style.setProperty('--var','calc(50vh + 4em)');
```
I know that this...
```
window.getComputedStyle(el).getPropertyValue('--var');
```
returns `calc(50vh + 4em)`

But I've often found myself needing to find out the resolved value, even if it's not used as the exact value of a property for which I could retrieve the resolved value.

So if the window.innerHeight was `600` and the font-size resolved to `20px` on the element, I'd hope that something like...
```
window.getComputedStyle(el)['--var'];
```
Could return `380px`???

I know there may be more pertinent topics to discuss related to `getComputedStyle` such as https://github.com/w3c/csswg-drafts/issues/2149, https://github.com/w3c/csswg-drafts/issues/379, or https://github.com/w3c/csswg-drafts/issues/1033, but for now, I am usually forced to cause a decent amount of layout thrashing to accomplish what is described above.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2358 using your GitHub account
Received on Saturday, 24 February 2018 21:48:33 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:24 UTC