@miaskiewicz/turbo-dom 0.1.12 → 0.1.13

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.12",
3
+ "version": "0.1.13",
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
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -64,6 +64,10 @@ class TurboFormData {
64
64
  function tagClass(matcher) {
65
65
  const test = typeof matcher === 'string' ? (n) => n === matcher : (n) => matcher.test(n);
66
66
  const C = function () { throw new TypeError('Illegal constructor'); };
67
+ // share Element.prototype so prototype-level spies/reads resolve (e.g.
68
+ // vi.spyOn(HTMLAnchorElement.prototype, 'click')); instanceof is decided by
69
+ // the tag matcher below, not the prototype chain.
70
+ C.prototype = Element.prototype;
67
71
  Object.defineProperty(C, Symbol.hasInstance, {
68
72
  value: (o) => o != null && o.nodeType === 1 && test(o.localName),
69
73
  });