Closed o0101 closed 2 years ago
re the node removed bug
i think i have an idea
when i insert nodes into document
i could create a map, node => cachedKey/instanceKey
so that upon removal, i create a set of the keys for all nodes removed, and then go through those keys removing them from the cache...next time the node is called (upon intending for it to be back in the view) it should be called first time and re-inserted into the DOM)
I think I can do this before I return retVal
about linkedCustomElement I think I have a quick and easy fix that avoids having to parse the attributes from the comment text content (as comments don't have attributes), we do this:
const df = document.createDocumentFragment();
const div = document.createElement('div');
df.appendChild(div);
div.insertAdjacentHTML('afterBegin', `
<span ${bangTag.textContent}></span>
`)
const span = div.querySelector('span');
Array.from(span.attributes).forEach(({name, value}) => {
if ( ! value && name.matches(DOUBLE_BARREL) ) return; // i.e., it's the bang tag name
lce.setAttribute(name, value);
});
// and then we have the attributes and we can update
so in the above example we get the attributes parsed automatically for us by assigning a string containing them to be the tag content of a span element created with insertAdjacentHTML
pretty fucking clever
And it's done! :P ;) xxx