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

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

From: jonjohnjohnson via GitHub <sysbot+gh@w3.org>
Date: Sun, 25 Feb 2018 20:54:41 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-368343670-1519592081-sysbot+gh@w3.org>
For anyone else that comes upon this, I figured I would clarify...

If creating the custom property in this way
```
CSS.registerProperty({
  name: '--var',
  syntax: '<length>',
  inherits: false,
  initialValue: '0px'
});
```
Then using
```
el.style.setProperty('--var','calc(50vh + 4em)');
window.getComputedStyle(el).getPropertyValue('--var')
```
Will in fact give you a resolved value like `380px` and not `calc(50vh + 4em)`

-- 
GitHub Notification of comment by jonjohnjohnson
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2358#issuecomment-368343670 using your GitHub account
Received on Sunday, 25 February 2018 20:54:45 UTC

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