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

> 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.

Yes, that's right. I'm not 100% sure how easy would be to make style["--my-var"] work, btw, would need to dig more into it.

There's lack of interop in how those properties are implemented (Firefox is the only one who follows the spec to the letter as far as I know), and IIRC they're defined in terms of WebIDL attributes, which means that the name would need to be known statically, which is obviously impossible in this case.

Also, another thing to check is what would be the iteration order. In Gecko we preserve the specified cascade order.

In WebKit it looks like it's just however the HashTable implementation ends up storing them...

 * http://webkit.crisal.io/webkit/rev/6cc00baaf9835dc4abdf7b16e72cff60ecd7bb88/Source/WebCore/css/CSSValue.h#280
 * http://webkit.crisal.io/webkit/rev/6cc00baaf9835dc4abdf7b16e72cff60ecd7bb88/Source/WebCore/css/CSSComputedStyleDeclaration.cpp#4188

That is a bit nasty.

I prefer what Gecko does, but Gecko doesn't have non-inherited custom properties yet, and if we had we'd want separate storage for them...

Alphabetic order would be better IMO, but then that makes the getter potentially expensive, because you need to sort your internal representation of the map...

So at this point I'm not sure what's better. I'd prefer to not leave the ordering of the properties unspecified. :-(

Ideas?

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

Received on Thursday, 4 April 2019 23:02:55 UTC