3 ms·
Not sure if it's implemented in superdom but: for(i = 0; i < dom.class.<class>.length; i++) { console.log(dom.class.<class>[i].<attr>); } The DO
by shakna 10y ago
Not sure if it's implemented in superdom but:
for(i = 0; i < dom.class.<class>.length; i++) {
console.log(dom.class.<class>[i].<attr>);
}
The DOM API isn't consistent, and that's what I hate about it.
Compare:
Creating an element:
var newDiv = document.createElement("div");
body.appendChild(newDiv);
Deleting an element:
var element = document.getElementById("element-id");
element.parentNode.removeChild(element);
Why does an element know how to remove its children but not itself?
Superdom:
delete dom.id.element-id
Sure, there are some edge cases and roughness here, but its a library, not something curated and argued over by the various browsers until something roughly compliant appears.