@miaskiewicz/turbo-dom 0.2.1 → 0.2.2

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.2.1",
3
+ "version": "0.2.2",
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",
@@ -845,6 +845,13 @@ export class Element extends Node {
845
845
  hasAttributeNS(_ns, name) { return this.hasAttribute(name); }
846
846
  removeAttributeNS(_ns, name) { this.removeAttribute(name); }
847
847
  getAttributeNode(name) { const a = (this.__attrs ?? (this.__attrs = this.__buildAttrs())).find((x) => x.name === name); return a ? { name: a.name, value: a.value, ownerElement: this } : null; }
848
+ getAttributeNodeNS(_ns, name) { return this.getAttributeNode(name); }
849
+ // Attr-node methods are thin shims over the name-based API (no real Attr/NamedNodeMap).
850
+ // React 19's releaseSingletonInstance reads node.attributes (a detached array copy) then
851
+ // removeAttributeNode(attr)s each — safe because the iterated copy isn't __attrs.
852
+ setAttributeNode(attr) { const prev = this.getAttributeNode(attr.name); this.setAttribute(attr.name, attr.value); return prev; }
853
+ setAttributeNodeNS(attr) { return this.setAttributeNode(attr); }
854
+ removeAttributeNode(attr) { const removed = this.getAttributeNode(attr && attr.name); if (attr && attr.name != null) this.removeAttribute(attr.name); return removed; }
848
855
 
849
856
  // adjacency
850
857
  insertAdjacentElement(position, el) {