diff --git a/src/htmx.js b/src/htmx.js index 47e5e23c..3a7a755f 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -1749,7 +1749,7 @@ return (function () { function getSwapSpecification(elt) { var swapInfo = getClosestAttributeValue(elt, "hx-swap"); var swapSpec = { - "swapStyle" : htmx.config.defaultSwapStyle, + "swapStyle" : getInternalData(elt).boosted ? 'innerHTML' : htmx.config.defaultSwapStyle, "swapDelay" : htmx.config.defaultSwapDelay, "settleDelay" : htmx.config.defaultSettleDelay } diff --git a/test/attributes/hx-boost.js b/test/attributes/hx-boost.js index 49483b3c..a17aca0f 100644 --- a/test/attributes/hx-boost.js +++ b/test/attributes/hx-boost.js @@ -57,5 +57,19 @@ describe("hx-boost attribute", function() { }) + it('overriding default swap style does not effect boosting', function () { + htmx.config.defaultSwapStyle = "afterend"; + try { + this.server.respondWith("GET", "/test", "Boosted"); + var a = make('Foo'); + a.click(); + this.server.respond(); + a.innerHTML.should.equal("Boosted"); + } finally { + htmx.config.defaultSwapStyle = "innerHTML"; + } + }) + + });