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 c24fb71 commit 5ab508fCopy full SHA for 5ab508f
1 file changed
src/htmx.js
@@ -754,17 +754,14 @@ var htmx = (function() {
754
}
755
756
/**
757
+ * Checks whether the element is in the document (includes shadow roots).
758
+ * This function this is a slight misnomer; it will return true even for elements in the head.
759
+ *
760
* @param {Node} elt
761
* @returns {boolean}
762
*/
763
function bodyContains(elt) {
- // IE Fix
- const rootNode = elt.getRootNode && elt.getRootNode()
- if (rootNode && rootNode instanceof window.ShadowRoot) {
764
- return getDocument().body.contains(rootNode.host)
765
- } else {
766
- return getDocument().body.contains(elt)
767
- }
+ return elt.getRootNode({ composed: true }) === document
768
769
770
0 commit comments