capricorn86 / happy-dom

A JavaScript implementation of a web browser without its graphical user interface
MIT License
3.09k stars 185 forks source link

Regression from 13.6.2 to 13.7.0: clicking a checkbox no longer fires a `change` event #1397

Closed cyyynthia closed 1 month ago

cyyynthia commented 3 months ago

Describe the bug When triggering a click event on an HTMLInputElement, the change event is no longer fired in version 13.7.0 and up. Seems to affect all versions up to latest.

To Reproduce Steps to reproduce the behavior:

  1. Get an HTMLInputElement with an event listener attached to the change event
  2. Trigger a click (using .dispatchEvent(new MouseEvent('click'))
  3. Observe that the event listener hasn't been fired

Expected behavior The click and change events should both be fired.

Device:

cyyynthia commented 3 months ago

After a bit more testing; it seems the tooling I'm using does dispatch a new MouseEvent('click'), which does not extend PointerEvent causing the instanceof checks to fail. Hope this helps!

dbritto-dev commented 1 month ago

@capricorn86 👆🏼

capricorn86 commented 1 month ago

Thank you for reporting @cyyynthia and @dbritto-dev! :slightly_smiling_face:

There is a fix in now: https://github.com/capricorn86/happy-dom/releases/tag/v14.10.2