Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,17 +754,14 @@ var htmx = (function() {
}

/**
* Checks whether the element is in the document (includes shadow roots).
* This function this is a slight misnomer; it will return true even for elements in the head.
*
* @param {Node} elt
* @returns {boolean}
*/
function bodyContains(elt) {
// IE Fix
const rootNode = elt.getRootNode && elt.getRootNode()
if (rootNode && rootNode instanceof window.ShadowRoot) {
return getDocument().body.contains(rootNode.host)
} else {
return getDocument().body.contains(elt)
}
return elt.getRootNode({ composed: true }) === document
}

/**
Expand Down