Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is DOM manipulation asynchronous (when using the API provided by the browsers like getElementById or appendChild)?

This bugs me. I just watched Philip Roberts's video about the event loop and got an understanding of how the API calls will eventually put callbacks in the callback queue. But he only mentioned the XMLHtppRequest and the time out functions. What about DOM API (document.getElementById, document.appendChild)? Does they make the same effect?

like image 453
Best_Name Avatar asked Dec 21 '25 17:12

Best_Name


1 Answers

DOM manipulation is synchronous, however, the browser's re-rendering of the page in response to a DOM update is asynchronous. This can give the illusion of an asynchronous DOM update.

like image 197
Quentin Avatar answered Dec 23 '25 06:12

Quentin