admin管理员组文章数量:1327750
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?
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?
Share Improve this question asked May 6, 2018 at 13:40 Best_NameBest_Name 1593 silver badges13 bronze badges 1- Is DOM manipulation asynchronous (when using the API provided by the browsers like getElementById or appendChild)? I don't think so – Muhammad Usman Commented May 6, 2018 at 13:43
2 Answers
Reset to default 7DOM 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.
No, they don't do any long-running stuff in the background that would require notifying you when it is ready. They directly manipulate the DOM tree. You can also infer this from the fact that there are no callbacks involved.
本文标签:
版权声明:本文标题:javascript - Is DOM manipulation asynchronous (when using the API provided by the browsers like getElementById or appendChild)? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742234269a2437783.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论