We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 240567b commit 6299b57Copy full SHA for 6299b57
web_src/js/utils/dom.js
@@ -59,9 +59,11 @@ export function onDomReady(cb) {
59
}
60
61
62
+// checks whether an element is owned by the current document, and whether it is a document fragment or element node
63
+// if it is, it means it is a "normal" element managed by us, which can be modified safely.
64
export function isDocumentFragmentOrElementNode(el) {
65
try {
- return el.nodeType === Node.ELEMENT_NODE || el.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
66
+ return el.ownerDocument === document && el.nodeType === Node.ELEMENT_NODE || el.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
67
} catch {
68
// in case the el is not in the same origin, then the access to nodeType would fail
69
return false;
0 commit comments