@miaskiewicz/turbo-dom 0.1.14 → 0.1.15

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.14",
3
+ "version": "0.1.15",
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",
@@ -545,7 +545,15 @@ export class Element extends Node {
545
545
  return el;
546
546
  }
547
547
 
548
- click() { this.dispatchEvent(new Event('click', { bubbles: true, cancelable: true })); }
548
+ click() {
549
+ // WHATWG "click in progress" flag: a nested .click() on the same element
550
+ // (e.g. a parent onClick that re-clicks this element on the bubble path) is
551
+ // a no-op, which breaks the otherwise-infinite re-entrancy.
552
+ if (this.__clickInProgress) return;
553
+ this.__clickInProgress = true;
554
+ try { this.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, detail: 1 })); }
555
+ finally { this.__clickInProgress = false; }
556
+ }
549
557
  // pre-click activation (runs BEFORE click listeners; undone if preventDefault)
550
558
  __preClickActivation() {
551
559
  if (this.localName !== 'input') return null;