UNPKG

359 BJavaScriptView Raw
1htmx.defineExtension('morphdom-swap', {
2 isInlineSwap: function(swapStyle) {
3 return swapStyle === 'morphdom';
4 },
5 handleSwap: function (swapStyle, target, fragment) {
6 if (swapStyle === 'morphdom') {
7 morphdom(target, fragment.outerHTML);
8 return [target]; // let htmx handle the new content
9 }
10 }
11});