package.dist.idiomorph-htmx.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of idiomorph Show documentation
Show all versions of idiomorph Show documentation
an id-based DOM morphing library
The newest version!
(function () {
function createMorphConfig(swapStyle) {
if (swapStyle === "morph" || swapStyle === "morph:outerHTML") {
return { morphStyle: "outerHTML" };
} else if (swapStyle === "morph:innerHTML") {
return { morphStyle: "innerHTML" };
} else if (swapStyle.startsWith("morph:")) {
return Function("return (" + swapStyle.slice(6) + ")")();
}
}
htmx.defineExtension("morph", {
isInlineSwap: function (swapStyle) {
let config = createMorphConfig(swapStyle);
return config?.morphStyle === "outerHTML" || config?.morphStyle == null;
},
handleSwap: function (swapStyle, target, fragment) {
let config = createMorphConfig(swapStyle);
if (config) {
return Idiomorph.morph(target, fragment.children, config);
}
},
});
})();
© 2015 - 2025 Weber Informatics LLC | Privacy Policy