@miaskiewicz/turbo-dom 0.1.49 → 0.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miaskiewicz/turbo-dom",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.50",
|
|
4
4
|
"description": "Faster, more spec-correct DOM for test runners — native html5ever (Rust/WASM) parser + lazy copy-on-write DOM. A drop-in-style alternative to jsdom/happy-dom for vitest & jest.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
package/src/runtime/dom.mjs
CHANGED
|
@@ -660,8 +660,16 @@ export class Element extends Node {
|
|
|
660
660
|
closest(sel) { let n = this; while (n && n.nodeType === ELEMENT_NODE) { if (n.matches(sel)) return n; n = n.parentNode; } return null; }
|
|
661
661
|
querySelector(sel) { return cachedQS(this, sel); }
|
|
662
662
|
querySelectorAll(sel) { return cachedQSA(this, sel); }
|
|
663
|
-
getElementsByTagName(tag) {
|
|
664
|
-
|
|
663
|
+
getElementsByTagName(tag) {
|
|
664
|
+
const self = this, t = tag.toLowerCase();
|
|
665
|
+
let cv = -1, ca; // version-cache the subtree walk within this collection (live; re-walk on mutation)
|
|
666
|
+
return liveHTMLCollection(() => { const d = self.ownerDocument, v = d ? (d.__version || 0) : 0; if (v === cv) return ca; cv = v; return (ca = collectByTag(self, t)); });
|
|
667
|
+
}
|
|
668
|
+
getElementsByClassName(cls) {
|
|
669
|
+
const self = this, classes = splitClasses(cls);
|
|
670
|
+
let cv = -1, ca;
|
|
671
|
+
return liveHTMLCollection(() => { const d = self.ownerDocument, v = d ? (d.__version || 0) : 0; if (v === cv) return ca; cv = v; return (ca = collectByClass(self, classes)); });
|
|
672
|
+
}
|
|
665
673
|
|
|
666
674
|
// ---- innerHTML / outerHTML ----
|
|
667
675
|
get innerHTML() { return serializeInner(this); }
|
|
@@ -953,8 +961,16 @@ export class ShadowRoot extends DocumentFragment {
|
|
|
953
961
|
visit(this);
|
|
954
962
|
return found;
|
|
955
963
|
}
|
|
956
|
-
getElementsByTagName(tag) {
|
|
957
|
-
|
|
964
|
+
getElementsByTagName(tag) {
|
|
965
|
+
const self = this, t = tag.toLowerCase();
|
|
966
|
+
let cv = -1, ca; // version-cache the subtree walk within this collection (live; re-walk on mutation)
|
|
967
|
+
return liveHTMLCollection(() => { const d = self.ownerDocument, v = d ? (d.__version || 0) : 0; if (v === cv) return ca; cv = v; return (ca = collectByTag(self, t)); });
|
|
968
|
+
}
|
|
969
|
+
getElementsByClassName(cls) {
|
|
970
|
+
const self = this, classes = splitClasses(cls);
|
|
971
|
+
let cv = -1, ca;
|
|
972
|
+
return liveHTMLCollection(() => { const d = self.ownerDocument, v = d ? (d.__version || 0) : 0; if (v === cv) return ca; cv = v; return (ca = collectByClass(self, classes)); });
|
|
973
|
+
}
|
|
958
974
|
// the topmost root of any node within is this shadow root, never the document
|
|
959
975
|
get activeElement() { return null; }
|
|
960
976
|
}
|
|
Binary file
|