Closed Pauan closed 9 years ago
Writing to the DOM 'invalidates' the current layout, meaning any subsequent reads in the same frame will force a layout. Reading from a clean/valid DOM is free, and doesn't force a layout.
Therefore reading and then writing is the most efficient way to flush the queue.
Hope that answers your question. On 7 Nov 2014 15:37, "Pauan" notifications@github.com wrote:
I noticed that the read queue is run before the write queue. I'm curious: what are the reasons for running read before write?
— Reply to this email directly or view it on GitHub https://github.com/wilsonpage/fastdom/issues/49.
So what you're saying is, letting the browser run the relayout on its own time, after the current requestAnimationFrame but before the next one, is faster than forcing a relayout in the current requestAnimationFrame? If so, then that does answer my question, thanks.
Yeah, that sounds correct to me. May your apps be fast :)
On Tuesday, November 11, 2014, Pauan notifications@github.com wrote:
Closed #49 https://github.com/wilsonpage/fastdom/issues/49.
— Reply to this email directly or view it on GitHub https://github.com/wilsonpage/fastdom/issues/49#event-191070441.
I noticed that the read queue is run before the write queue. I'm curious: what are the reasons for running read before write?