-
Notifications
You must be signed in to change notification settings - Fork 463
Element error event handler #2377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cosmic-pixel-painter
wants to merge
7
commits into
microsoft:main
Choose a base branch
from
cosmic-pixel-painter:dom-base-event-handler
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Element error event handler #2377
cosmic-pixel-painter
wants to merge
7
commits into
microsoft:main
from
cosmic-pixel-painter:dom-base-event-handler
+141
−27
Conversation
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
Contributor
|
Thanks for the PR! This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged. |
saschanaz
reviewed
Jan 11, 2026
Co-authored-by: Kagami Sascha Rosylight <saschanaz@outlook.com>
Author
|
@saschanaz I was able to fix it using the KDL file and didn't need to touch the |
Author
|
Hey @saschanaz it's ready for another look. Let me know what you think 😄 |
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.
This PR fixes microsoft/TypeScript#62075. and is a result of the comment left on the PR over here, which I closed. Thanks for the advice on that 🙏 . I re-read your comment and figured out a path forward. I also dropped
UIEventfrom this PR.Recap
As a recap, this handles this bug report here. The issue is that
HTMLElement.onerror(and other elementonerrorhandlers) uses the incorrect interfaceOnErrorEventHandler, which has the signature:This causes a type error when assigning a Event-based handler:
It should be that
window.onerrorusesOnErrorEventHandlerand elements uses theEventobject.Changes
GlobalEventHandlers.onerrorto use anevent-basedhandler instead ofOnErrorEventHandler. I did this by updatingevents.kdlto useEventinstead ofErrorEvent.window.onerrorto keep usingOnErrorEventHandlersinceWindowis the only place where this handler signature is expected.WindowextendsGlobalEventHandlers and both defineonerrordifferently. This was happening in the global scope "polluter". I fixed this by tracking already emitted members inemitAllMembers.Before/After
Before:
After:
Testing
I added the
onerror.tstest file and updated theeventlistener.tstest file.Other Thoughts
This has been a crazy and fun bug to hunt down. I think I nailed it this time 😂