📜  验证DOMNesting(...):<div>不能作为后代出现<p>. - Javascript代码示例

📅  最后修改于: 2022-03-11 15:01:07.694000             🧑  作者: Mango

代码示例2

...

//According to this document, a

tag can only contain inline elements. That means putting a
tag inside it should be improper, since the div tag is a block element. Improper nesting might cause glitches like rendering extra tags, which can affect your javascript and css. //If you want to get rid of this warning, you might want to customize the ReactTooltip component, or wait for the creator to fix this warning. //If you're looking for where this is happening, in console you can use: document.querySelectorAll(" p * div ") //Here's another version that made finding the item more verbose for me document.querySelectorAll("p > div")