Fast Shallow Array Cloning in Javascript

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2024-05-16 11:40:24 +02:00
parent ad8bf546d2
commit ee2b80d388
574 changed files with 39772 additions and 745 deletions
+9
View File
@@ -0,0 +1,9 @@
// :has() is still missing in many browsers.
document.querySelectorAll("*").forEach((v, k) => {
let s = new Set();
for (let c of v.children) {
s.add(c.tagName.toLocaleLowerCase());
}
if (s.size > 0)
v.dataset["has"] = Array.from(s.values()).join(" ");
});