I was wondering if the DOM node attributes are synchronous in terms of style information? I read the following article and I read the next line
Scripts requesting style information, such as "offsetHeight", can run an incremental layout synchronously.
It’s clear from the article that there is a “dirty node system” that pauses script execution until the document is fully laid out. So, if I had a dirty node n, if n.offsetHeight was called from javascript, the article assumes that n.offsetHeight will not return until the offset height has been fully confirmed. How do I get it right? Can I rely on the browser to always give me the current stable version of any attached DOM element.
Briefly, if I change some style to node (using the style attribute, class names, dynamic css, something else), and then read some property that depends on the specified style, can I always be sure that the value that I right, will be the node value with my previous style? If this is not the case, how do you know when my style changes were applied?
source share