feat: add render event listener for in-place DOM re-initialization

This commit is contained in:
saberzero1 2026-03-12 19:45:37 +01:00
parent 3374c99008
commit 4593694be6
No known key found for this signature in database

View file

@ -3,7 +3,7 @@ const svgCopy =
const svgCheck =
'<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" fill="rgb(63, 185, 80)" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>';
document.addEventListener("nav", () => {
const setupClipboard = () => {
const els = document.getElementsByTagName("pre");
for (let i = 0; i < els.length; i++) {
const el = els[i];
@ -36,4 +36,7 @@ document.addEventListener("nav", () => {
el.prepend(button);
}
}
});
};
document.addEventListener("nav", setupClipboard);
document.addEventListener("render", setupClipboard);