Quote:
Originally Posted by xelawho
Thanks, Ali,
but I think this is what's annoying me, that you have to do this extra check:?
|
you can define a new property, like element.display, and then use getters and setters to instantly push the updates to the actual element.style.display property. that also gives you the event you need, and with zero CPU cost and no polling.
if you want to get ambitious, you can create a style2 property on each element, or Element.prototype, use a naive for-in on document.body.style to get the names of each known style property, and patch them to/from style2 by using Object.defineProperty(elm, property, {get: xxx, set:xxx}) in a loop.
this would give you a whole shadow style object with the chance to dispatch external functions before and/or after the actual element.style change is set, with object handles to the changing element.