We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这个错误通常是在当前文档(Document)插入其他文档的节点(Node)会产生的错误,常见于IE。
通常来说不同的文档间的节点不能相互插入,通常需要导入节点再插入到文档中,现代浏览器智能化了这个过程,导入操作由浏览器自身完成了。但并不是所有浏览器都是这么做的,因此先导入后插入是更为稳妥的做法。
var body = document.body; // current context var htmlString = '<div><span>123</span></div>'; var doc = new DOMParser().parseFromString(htmlString, 'text/html'); // other context console.log(body.ownerDocument === doc); // false // Mordern Browser (Not Recommend) // body.appendChild(doc.body.firstChild); var otherContextNode = doc.body.firstChild; var currentContextNode = document.importNode(otherContextNode, true); body.appendChild(currentContextNode);
The text was updated successfully, but these errors were encountered:
Aqours
No branches or pull requests
这个错误通常是在当前文档(Document)插入其他文档的节点(Node)会产生的错误,常见于IE。
通常来说不同的文档间的节点不能相互插入,通常需要导入节点再插入到文档中,现代浏览器智能化了这个过程,导入操作由浏览器自身完成了。但并不是所有浏览器都是这么做的,因此先导入后插入是更为稳妥的做法。
The text was updated successfully, but these errors were encountered: