DOM locking is something that many people unfamiliar with the strictly strict single-threaded JavaScript synchronous execution model will find out about the hard way, and this is usually what we want to work somehow (using timeouts, web workers, etc.) .d.). All is well and good.
However, I would like to know if blocking the actual user-visible rendering, which you really can rely on. I am 90% sure that this is de facto in most browsers, but I hope this is not just a happily sequential crash. I cannot find any final statements from the DOM specifications or even vendor documentation such as MDM.
I am a little worried that although changes to the DOM are not really visible on the page, the internal DOM geometry (including CSS transforms and filters) does update during synchronous execution. For example:
console.log(element.getBoundingRect().width); element.classList.add("scale-and-rotate"); console.log(element.getBoundingRect().width); element.classList.remove("scale-and-rotate");
... will indeed report two different widths, although the page does not seem to blink. Synchronized waiting after adding a class (using the while loop) also does not make temporary changes visible. Running a timeline graph in Chrome shows that the inner paint and re-coloring are the same, which makes sense ...
I am worried that, without a specific reason, some browsers, such as those dealing with low-power mobile processors, may actually reflect these internal calculations in a user-visible layout during the execution of this function and, therefore, in an ugly "flash" during such temporary operations. So, more specifically, I ask: do they have a specific reason not to do this?
(If you're wondering why I care about this at all, I sometimes need to measure calculated measurements with getBoundingRect for elements in a certain state in order to plan intervals or animations or other similar things, without inserting them into it first point out or animate them ... )
javascript dom html-rendering
rubyruy
source share