Is it possible to hook any inline-css changes without mutation observer but by binding some kind of event or override a prototype?
Asked
Active
Viewed 115 times
3
-
What do you mean by "hook"? – Ian Apr 24 '13 at 15:41
-
I mean bind an event or override a function inside of a prototype or something.. – Villi Katrih Apr 24 '13 at 15:44
-
You could introduce a wrapper function that sets all your css where you can register a callback. Doesn't work though, if you do not control all the css changes. – Christoph Apr 24 '13 at 16:07
1 Answers
1
There are mutation events (eg DOMAttrModified ) but theyre not supported by all browsers. See:
Event detect when css property changed using Jquery
In JQuery, Is it possible to get callback function after setting new css rule?
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-mutationevents
But I think the best solution might be to add a prototype method to all html elements which you use to set the css, and use that as your hook.
Its worth noting that changing css isnt async so you can rely on the next line of code firing after the change has happened:
In JQuery, Is it possible to get callback function after setting new css rule?

Community
- 1
- 1

Tom Elmore
- 1,980
- 15
- 20