htmx/dist/ext/morphdom-swap.js

12 lines
359 B
JavaScript

htmx.defineExtension('morphdom-swap', {
isInlineSwap: function(swapStyle) {
return swapStyle === 'morphdom';
},
handleSwap: function (swapStyle, target, fragment) {
if (swapStyle === 'morphdom') {
morphdom(target, fragment.outerHTML);
return [target]; // let htmx handle the new content
}
}
});