@miaskiewicz/turbo-dom 0.1.42 → 0.1.43

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.42",
3
+ "version": "0.1.43",
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",
@@ -1410,11 +1410,12 @@ export class Document extends Node {
1410
1410
  let node;
1411
1411
  switch (buf.nodeType(idx)) {
1412
1412
  case ELEMENT_NODE: {
1413
- node = new Element(this, buf.tagName(idx), buf.ns(idx));
1413
+ const tag = buf.tagName(idx); // read once (was read twice — ctor + template check)
1414
+ node = new Element(this, tag, buf.ns(idx));
1414
1415
  node.__idx = idx;
1415
1416
  node.__attrIdx = idx; // attrs lazy (constructor left __attrs undefined)
1416
1417
  // template content fragment: a child node typed 11 named "content"
1417
- if (buf.tagName(idx) === 'template') {
1418
+ if (tag === 'template') {
1418
1419
  for (let c = buf.firstChild(idx); c !== -1; c = buf.nextSib(c)) {
1419
1420
  if (buf.nodeType(c) === DOCUMENT_FRAGMENT_NODE && buf.tagName(c) === 'content') {
1420
1421
  node.content = this.__nodeAt(c);