W3C home > Mailing lists > Public > public-css-archive@w3.org > April 2019

Re: [csswg-drafts] [cssom] should custom properties be exposed on computed style declarations? (#1316)

From: Amelia Bellamy-Royds via GitHub <sysbot+gh@w3.org>
Date: Thu, 04 Apr 2019 22:47:40 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-480090427-1554418059-sysbot+gh@w3.org>
To confirm, the plan is that custom properties will be included in the iteration results of `getComputedStyle`  if the property has a value _other_ than the "empty initial value" for custom properties. 

This seems to be what Firefox is doing.  Including the properties in the iteration is consistent with how custom properties are treated in the `style` object for inline styles. (Test case, focusing just on custom properties and not on custom elements: https://codepen.io/AmeliaBR/full/JVXEzq)

I'm assuming this means that the computed style should also include any custom property that has an initial value because of `registerProperty`.

Firefox (and as far as I know, Safari) does _not_ currently support getting/setting custom properties using the named accessors (`style["--my-var"]`), so I'm guessing that is not part of the proposed edits at this time: you'd still need to use `getPropertyValue()` and `setProperty()` for those.



-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1316#issuecomment-480090427 using your GitHub account
Received on Thursday, 4 April 2019 22:47:42 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:06 UTC