Last active 6 months ago

portalzine's Avatar portalzine revised this gist 6 months ago. Go to revision

1 file changed, 10 insertions

htmx-mutationobserver.js(file created)

@@ -0,0 +1,10 @@
1 + const observer = new MutationObserver((mutations) => {
2 + mutations.forEach((mutation) => {
3 + mutation.addedNodes.forEach((node) => {
4 + if (node.nodeType === 1 && !node["htmx-internal-data"]) {
5 + htmx.process(node)
6 + }
7 + })
8 + })
9 + })
10 + observer.observe(document, {childList: true, subtree: true})
Newer Older