What is the meaning of “target element is not a descendant of root”?

折月煮酒 提交于 2020-01-22 19:32:05

问题


I got the following warning in the Chrome's console: "IntersectionObserver.observe(target): target element is not a descendant of root."

What is the meaning of this? How could I find the reason for it, in order to fix it?


回答1:


This warning appeared for me too. Chrome Debugging tool did not like an attribute in an element. I found the offending attribute by cutting out chunks of html and reloading the page until I narrowed it down to a single attribute.

for me it was this muted attribute...

Hope this helps.




回答2:


I got this warning when I was creating a HTMLVideoElement in JS, but not adding it to the body of the document, before playing it to extract the first frame image.

I worked around it by setting its display to none, appending the node as a child of the body, and in a later promise removing the element from the body.

So, I'd check if you're creating any DOM elements in JS, and not adding them to the body of the HTML document.



来源:https://stackoverflow.com/questions/40348444/what-is-the-meaning-of-target-element-is-not-a-descendant-of-root

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!