@miaskiewicz/turbo-dom 0.1.52 → 0.1.53
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.53",
|
|
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
|
@@ -934,7 +934,14 @@ export class DocumentFragment extends Node {
|
|
|
934
934
|
querySelectorAll(sel) { return cachedQSA(this, sel); }
|
|
935
935
|
get children() { if (this.__childrenList) return this.__childrenList; const self = this; return (this.__childrenList = liveHTMLCollection(() => self.__children().filter((n) => n.nodeType === ELEMENT_NODE))); }
|
|
936
936
|
append(...nodes) { for (const n of nodes) this.appendChild(toNode(this.ownerDocument, n)); }
|
|
937
|
-
cloneNode(deep = false) {
|
|
937
|
+
cloneNode(deep = false) {
|
|
938
|
+
const f = new DocumentFragment(this.ownerDocument);
|
|
939
|
+
if (deep) { // direct __kids build — detached clone, per-child appendChild bookkeeping is waste (see Element.cloneNode)
|
|
940
|
+
const src = this.__children(), od = f.ownerDocument, kids = f.__kids = new Array(src.length);
|
|
941
|
+
for (let i = 0; i < src.length; i++) { const cl = src[i].cloneNode(true); cl.parentNode = f; cl.ownerDocument = od; kids[i] = cl; }
|
|
942
|
+
}
|
|
943
|
+
return f;
|
|
944
|
+
}
|
|
938
945
|
}
|
|
939
946
|
|
|
940
947
|
// A real shadow root: a detached document-fragment subtree with a back-reference
|
|
Binary file
|