View Single Post
Old 01-07-2013, 10:36 AM   PM User | #5
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,553
Thanks: 9
Thanked 480 Times in 463 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Quote:
Originally Posted by xelawho View Post
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.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:15.2% IE7:0.5% IE8:8.4% IE9:8.5% IE10:8.5%

Last edited by rnd me; 01-07-2013 at 10:44 AM..
rnd me is offline   Reply With Quote