1 | htmx.defineExtension('morphdom-swap', {
|
2 | isInlineSwap: function(swapStyle) {
|
3 | return swapStyle === 'morphdom';
|
4 | },
|
5 | handleSwap: function (swapStyle, target, fragment) {
|
6 | if (swapStyle === 'morphdom') {
|
7 | if (fragment.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
8 | // IE11 doesn't support DocumentFragment.firstElementChild
|
9 | morphdom(target, fragment.firstElementChild || fragment.firstChild);
|
10 | return [target];
|
11 | } else {
|
12 | morphdom(target, fragment.outerHTML);
|
13 | return [target];
|
14 | }
|
15 | }
|
16 | }
|
17 | });
|