1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-07-04 21:42:14 +02:00

🐛 ddeStringable and simulateSlots

This commit is contained in:
2024-12-12 17:16:57 +01:00
parent 89553383bb
commit 94ac2becfc
4 changed files with 13 additions and 11 deletions

View File

@ -108,9 +108,11 @@ export function simulateSlots(element, root= element){
try{ elementAttribute(el, "remove", "slot"); } catch(_error){}
const slot= slots[name];
if(!slot) return;
if(!name.startsWith(mark_s)) slot.childNodes.forEach(c=> c.remove());
if(!slot.name.startsWith(mark_s)){
slot.childNodes.forEach(c=> c.remove());
slot.name= mark_s+name;
}
slot.append(el);
slot.name= mark_s+name;
//TODO?: el.dispatchEvent(new CustomEvent("dde:slotchange", { detail: slot }));
}
element.append= orig; //TODO?: better memory management, but non-native behavior!
@ -119,7 +121,7 @@ export function simulateSlots(element, root= element){
});
if(element!==root){
const els= Array.from(element.childNodes);
//els.forEach(el=> el.remove());
//TODO?: els.forEach(el=> el.remove());
element.append(...els);
}
return root;