diff --git a/src/htmx.js b/src/htmx.js index 539e1baa..90a98839 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -2277,7 +2277,7 @@ var htmx = (function() { * @param {HtmxTriggerSpecification[]} triggerSpecs */ function boostElement(elt, nodeData, triggerSpecs) { - if ((elt instanceof HTMLAnchorElement && isLocalLink(elt) && (elt.target === '' || elt.target === '_self')) || elt.tagName === 'FORM') { + if ((elt instanceof HTMLAnchorElement && isLocalLink(elt) && (elt.target === '' || elt.target === '_self')) || (elt.tagName === 'FORM' && String(getRawAttribute(elt, 'method')).toLowerCase() !== 'dialog')) { nodeData.boosted = true let verb, path if (elt.tagName === 'A') { diff --git a/test/attributes/hx-boost.js b/test/attributes/hx-boost.js index d8156778..e6562e48 100644 --- a/test/attributes/hx-boost.js +++ b/test/attributes/hx-boost.js @@ -71,6 +71,14 @@ describe('hx-boost attribute', function() { div.innerHTML.should.equal('Boosted') }) + it('does not boost forms with method="dialog"', function() { + make('
') + var form = byId('f1') + + var internalData = htmx._('getInternalData')(form) + should.equal(undefined, internalData.boosted) + }) + it('handles basic anchor properly w/ data-* prefix', function() { this.server.respondWith('GET', '/test', 'Boosted') var div = make('')