Repository navigation
Fix dom.unbind calling nonexistent removeEventListeners - #868
Merged
jonobr1 merged 2 commits intoOct 10, 2026
Merged
Conversation
dom.unbind called elem.removeEventListeners (plural), which does not exist on DOM elements, so unbinding threw a TypeError instead of detaching the listener. Call removeEventListener and add a QUnit test that binds, unbinds and dispatches to verify the handler is detached. Fixes #850
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The fix is correct, scoped, and directly covered by a regression test.
0 open findings
What changed in this PR
Fixes dom.unbind so it correctly removes modern DOM event listeners.
Changes:
- Corrects the DOM API method name.
- Adds a focused browser regression test.
- Registers the test in the QUnit runner.
| File | Description |
|---|---|
src/utils/dom.js |
Uses removeEventListener. |
tests/suite/dom.js |
Tests binding and unbinding behavior. |
tests/index.html |
Loads the new test suite. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Owner
|
Wow, thank you! This was a bonehead move on my part 🤷♂️ |
jonobr1
approved these changes
Oct 9, 2026
jonobr1
left a comment
Owner
There was a problem hiding this comment.
Appreciate you added tests as well! Everything passes and looks good.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
dom.unbind(src/utils/dom.js) callselem.removeEventListeners(...)in its modern branch. That method does not exist on DOM elements, so any call throwsTypeError: elem.removeEventListeners is not a functioninstead of detaching the listener.Cause
Typo: plural
removeEventListenersinstead of the DOM APIremoveEventListener.Fix
Call
elem.removeEventListener(event, func, !!bool)sodom.unbindsymmetrically undoesdom.bind. The legacydetachEventfallback is unchanged.Tests
tests/suite/dom.js(loaded fromtests/index.htmlas a module so it can import the internaldomhelper): binds a click handler, dispatches, unbinds, dispatches again and asserts the handler is no longer called and thatunbindreturnsdomwithout throwing.dom.unbindassertions fail; with the fix they pass. Ran the suite in headless Chrome: the other results are unchanged (the 5makeImage/ bounding-box failures happen ondevwithout this change in my headless setup too).npx eslint src/utils/dom.js tests/suite/dom.jsandnpm run types:checkpass.Fixes #850