@miaskiewicz/turbo-dom 0.1.33 → 0.1.34

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.33",
3
+ "version": "0.1.34",
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",
@@ -363,6 +363,16 @@ export class Element extends Node {
363
363
  this.__attrIdx = -1; // buffer index for lazy attr inflation
364
364
  this.content = null; // <template> content fragment
365
365
  this.shadowRoot = null; // open shadow root, if attached
366
+ // Predeclare the hot lazy fields (left at their "absent" sentinel) so every
367
+ // Element shares ONE hidden class. Without this, fields added on demand in
368
+ // varying order across elements make the shared query/match/style/event code
369
+ // megamorphic on property loads. Costs a few in-object slots, buys monomorphism.
370
+ this.__childNodesList = undefined; // childNodes NodeList (memoized live view)
371
+ this.__childrenList = undefined; // children HTMLCollection (memoized live view)
372
+ this.__qaCache = undefined; // querySelectorAll cache (selector → {v,r})
373
+ this.__qsCache = undefined; // querySelector cache
374
+ this.__computedStyle = undefined; // getComputedStyle snapshot (version-keyed)
375
+ this.__shadow = undefined; // attached shadow root (open or closed)
366
376
  }
367
377
 
368
378
  get nodeType() { return ELEMENT_NODE; }