Skip to content

Commit c1bea43

Browse files
committed
create fragment lazily from scrhartley
1 parent a1a5dc0 commit c1bea43

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/htmx.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,15 +1480,16 @@ var htmx = (function() {
14801480
function(target) {
14811481
let fragment
14821482
const oobElementClone = oobElement.cloneNode(true)
1483-
fragment = getDocument().createDocumentFragment()
1484-
fragment.appendChild(oobElementClone)
14851483
if (swapSpec.strip === undefined && !isInlineSwap(swapSpec.swapStyle, target)) {
14861484
swapSpec.strip = true
14871485
}
14881486
if (swapSpec.strip) {
14891487
// @ts-ignore if elt is template, content will be valid so use as inner content
14901488
fragment = oobElementClone.content || asParentNode(oobElementClone) // if this is not an inline swap, we use the content of the node, not the node itself
14911489
swapSpec.strip = undefined
1490+
} else {
1491+
fragment = getDocument().createDocumentFragment()
1492+
fragment.appendChild(oobElementClone)
14921493
}
14931494

14941495
const beforeSwapDetails = { shouldSwap: true, target, fragment, swapSpec }

0 commit comments

Comments
 (0)