let observer = new MutationObserver( (mutationRecords) => {
for (let mr of mutationRecords) {
for (let el of mr.addedNodes) {
if (el.nodeName === 'DIV') {
alert("DOMNodeInserted DIV")
}
}
}
})
observer.observe(document.body, {childList:true, subtree: true})
在document未加载完成等情况下无法使用DOMContentLoaded,可以用如上api代替
最后
以上就是无情音响最近收集整理的关于关于DOMContentLoaded死活无效的解决方案的全部内容,更多相关关于DOMContentLoaded死活无效内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复