2 ms·
They are all updated in the same JavaScript function. However each clock is updated in a seperate call to .innerHTML. This means the DOM is updated seperately
by missblit 7y ago
They are all updated in the same JavaScript function.
However each clock is updated in a seperate call to .innerHTML. This means the DOM is updated seperately for each clock instead of just once for all the clocks.
So depending on how eager your browser is about doing layouts, I could imagine different clocks updating on different frames to be a possibility.
- stjo 7y agoI’m fairly sure the JS standard guarantees that no layouting (or any form of rendering) would happen mid function execution. Haven’t looked in the source code yet, but if they do function updateAllClocks() { A.innerHTML = ...; B.innerHTML = ...; } Then A and B would update on the screen on the same frame and the order doesn’t matter (If A is not parent of B or vice versa of course) This is not true if they do a lot of setTimeouts(), but is true for all other “normal” synchronous code.
- chrisseaton 7y ago> I’m fairly sure the JS standard guarantees that no layouting (or any form of rendering) would happen mid function execution. I think the JS standard doesn't have any notion or layout of rendering. Which part of the standard are you referring to?