Sha256: 708b1973238c5782d0af0eaa56e3c0f733bb4f74d27b52eb8773e318b4c80b98
Contents?: true
Size: 1.13 KB
Versions: 41
Compression:
Stored size: 1.13 KB
Contents
function morph(from, to) { Alpine.morph(from, to, { key(el) { return el.getAttribute("key") ? el.getAttribute("key") : el.id; }, lookahead: true, updating(el, toEl, childrenOnly, skip) { if ( el.getAttribute && el.getAttribute("data-morph-strategy") === "replace" ) { el.innerHTML = toEl.innerHTML; return skip(); } }, }); } function getElementSize(el, opts = {}) { const style = window.getComputedStyle(el, null); return { width: opts.includeMargins ? el.offsetWidth + parseInt(style.getPropertyValue("margin-left")) + parseInt(style.getPropertyValue("margin-right")) : el.offsetWidth, height: opts.includeMargins ? el.offsetHeight + parseInt(style.getPropertyValue("margin-top")) + parseInt(style.getPropertyValue("margin-bottom")) : el.offsetHeight, }; } function isExternalLink(link) { if (link.getAttribute("target") === "_blank") { return true; } if (link.href) { return link.host !== window.location.host; } return false; } export { morph, getElementSize, isExternalLink };
Version data entries
41 entries across 41 versions & 1 rubygems