RE: [css-om] CSSStyleDeclaration.parentElement

> If I get this right you want to be able to write custom
> CSSStyleDeclaration getter/setters; but the setter will almost always want
> to know what element it applies to. While that makes sense it also sounds
> like pure polyfilling API; or are there other use-cases that would make
> use of it? 

If fixing implementation bugs does not qualify as polyfilling, you may also want to patch an existing property. I don't think I can see much use for extending CSSStyleDeclaration otherwise, but maybe there's and I just don't know about.



> If there are other scenarios where developers want to know
> whether a CSS property value changed for a set of elements then we'd
> probably want a different API and pass the relevant information to the
> author's event handler(s). (This suggestion is solely meant to suggest
> how/why it may help to think beyond polyfilling).

Definitely, but I feel like this is another story. My issue here is that for now there's no way to make the "element.style.xyz" stuff working, and that issue is completely related to the CSSStyleDeclaration interface alone.

Meanwhile, I definitely believe for a long time that a "Style Mutation Observer" would help polyfilling scenarios, and also some very interesting other use cases (like live query detection). The good thing here is that this is not totally impractical since, as Boris noted, css properties are already partially observable for transition purposes. Extending this observability a little bit shouldn't be that hard, but this is another story that will yields other problems.

That being said, a setter could be made working on the basis of this SMO by harnessing some CSS Custom Property (ie: remap flow-from to var-css-flow-from and listen for changes to this property). This could possibly make a getter working, too.

This seems like a non-necessary work-around, however... 		 	   		  

Received on Friday, 23 August 2013 17:03:10 UTC