')
+ button.click()
+ this.server.respond()
+ target.innerHTML.should.equal('Original')
+ var template = button.querySelector('template')
+ should.not.equal(template, null)
+ template.content.querySelector('span').textContent.should.equal('Nested')
+ template.content.querySelector('span').hasAttribute(attribute).should.equal(false)
+ })
+ }
+
it('oob swap keeps templates not used for oob swap encapsulation', function() {
this.server.respondWith('GET', '/test', '' +
'Clicked')
diff --git a/www/content/attributes/hx-swap-oob.md b/www/content/attributes/hx-swap-oob.md
index 1b7b61e3f..11622838f 100644
--- a/www/content/attributes/hx-swap-oob.md
+++ b/www/content/attributes/hx-swap-oob.md
@@ -118,6 +118,7 @@ By default, any element with `hx-swap-oob=` attribute anywhere in the response i
This can be problematic when using [template fragments](https://htmx.org/essays/template-fragments/) where a fragment may be reused as an oob-swap target and also as part of a bigger fragment. When the bigger fragment is the main response the inner fragment will still be processed as an oob swap, removing it from the dom.
This behavior can be changed by setting the config `htmx.config.allowNestedOobSwaps` to `false`. If this config option is `false`, OOB swaps are only processed when the element is *adjacent to* the main response element, OOB swaps elsewhere will be ignored and oob-swap-related attributes stripped.
+Templates containing only ignored nested OOB elements are retained in the main response; they are not discarded as OOB encapsulation wrappers.
## Notes