@miaskiewicz/turbo-dom 0.1.45 → 0.1.46
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.46",
|
|
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/window.mjs
CHANGED
|
@@ -133,7 +133,8 @@ export function createWindow(document, { url = 'http://localhost/' } = {}) {
|
|
|
133
133
|
document,
|
|
134
134
|
name: '',
|
|
135
135
|
closed: false,
|
|
136
|
-
origin
|
|
136
|
+
// origin is lazy (per-env, captures url) — window.origin is rarely read, so the
|
|
137
|
+
// eager `new URL(url)` parse per createWindow was usually wasted.
|
|
137
138
|
// customElements is lazy (SHARED_LAZY) — env-independent + rarely used; building
|
|
138
139
|
// its two Maps eagerly per createWindow was wasted for the typical test.
|
|
139
140
|
Image: function Image(w, h) { const img = document.createElement('img'); if (w != null) img.setAttribute('width', w); if (h != null) img.setAttribute('height', h); return img; },
|
|
@@ -148,6 +149,7 @@ export function createWindow(document, { url = 'http://localhost/' } = {}) {
|
|
|
148
149
|
// Everything env-independent lives in the module-level SHARED_LAZY (built once,
|
|
149
150
|
// not re-allocated per test file) — see below. None constructed until touched.
|
|
150
151
|
const lazy = {
|
|
152
|
+
origin: () => new URL(url).origin,
|
|
151
153
|
// subsystem grouping: history co-materializes with (and shares) location
|
|
152
154
|
location: () => makeLocation(url),
|
|
153
155
|
history: () => makeHistory(windowProxy.location),
|
|
Binary file
|