-
Notifications
You must be signed in to change notification settings - Fork 458
Html element onerror eventhandler override #2272
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
8
commits into
microsoft:main
Choose a base branch
from
cosmic-pixel-painter:html-element-onerror-eventhandler-override
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0dc24aa
added overriding type to dom lib
cosmic-pixel-painter 9b4cda8
added onerror test
cosmic-pixel-painter ac15d69
added event listener fix to html and svg element
cosmic-pixel-painter 33ad906
added comments to eventlistener test
cosmic-pixel-painter 72be5b4
addressed style comment
cosmic-pixel-painter 88eb1fc
reverted style change
cosmic-pixel-painter 2503891
gave overriding type a more descriptive name
cosmic-pixel-painter 6fc3c1b
updated baselines
cosmic-pixel-painter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15071,7 +15071,7 @@ interface GlobalEventHandlers { | |
| /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/ended_event) */ | ||
| onended: ((this: GlobalEventHandlers, ev: Event) => any) | null; | ||
| /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/error_event) */ | ||
| onerror: OnErrorEventHandler; | ||
| onerror: DocumentOrGlobalOnErrorEventHandler; | ||
| /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/focus_event) */ | ||
| onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; | ||
| /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/formdata_event) */ | ||
|
|
@@ -29370,6 +29370,12 @@ interface SVGElement extends Element, ElementCSSInlineStyle, GlobalEventHandlers | |
| * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SVGElement/viewportElement) | ||
| */ | ||
| readonly viewportElement: SVGElement | null; | ||
| /** | ||
| * The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. | ||
| * | ||
| * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) | ||
| */ | ||
| addEventListener(type: string, listener: ((event: Event) => void) | ((event: UIEvent) => void)): void; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not quite right as this affects all other events. And still not sure about UIEvent:
So I'd like to suggest excluding UIEvent in this PR. |
||
| addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; | ||
| addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; | ||
| removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; | ||
|
|
@@ -31734,6 +31740,12 @@ interface SVGSVGElement extends SVGGraphicsElement, SVGFitToViewBox, WindowEvent | |
| unsuspendRedraw(suspendHandleID: number): void; | ||
| /** @deprecated */ | ||
| unsuspendRedrawAll(): void; | ||
| /** | ||
| * The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. | ||
| * | ||
| * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) | ||
| */ | ||
| addEventListener(type: string, listener: ((event: Event) => void) | ((event: UIEvent) => void)): void; | ||
| addEventListener<K extends keyof SVGSVGElementEventMap>(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; | ||
| addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; | ||
| removeEventListener<K extends keyof SVGSVGElementEventMap>(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; | ||
|
|
@@ -41635,7 +41647,7 @@ declare var onemptied: ((this: Window, ev: Event) => any) | null; | |
| /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/ended_event) */ | ||
| declare var onended: ((this: Window, ev: Event) => any) | null; | ||
| /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/error_event) */ | ||
| declare var onerror: OnErrorEventHandler; | ||
| declare var onerror: DocumentOrGlobalOnErrorEventHandler; | ||
| /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/focus_event) */ | ||
| declare var onfocus: ((this: Window, ev: FocusEvent) => any) | null; | ||
| /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/formdata_event) */ | ||
|
|
@@ -41912,6 +41924,7 @@ type ConstrainDouble = number | ConstrainDoubleRange; | |
| type ConstrainULong = number | ConstrainULongRange; | ||
| type CookieList = CookieListItem[]; | ||
| type DOMHighResTimeStamp = number; | ||
| type DocumentOrGlobalOnErrorEventHandler = (((event: Event) => any) | ((event: UIEvent) => any) | OnErrorEventHandlerNonNull) | null; | ||
| type EpochTimeStamp = number; | ||
| type EventListenerOrEventListenerObject = EventListener | EventListenerObject; | ||
| type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams; | ||
|
|
||
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also affects all other interfaces so it partially repeats the same issue of OnErrorEventHandler, and also not quite I suggested in #2148 (comment)...
I was thinking about:
And make others inherit this instead of GlobalEventHandlers when appropriate. Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that as-is has an assignability issue. Hmm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do have
extendConflictsBaseTypesin emitter.ts which can help here... it's sad to add more there but it does make sense here.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing so would make subinterfaces to fail to assign to a variable typed as GlobalEventHandlers, which is a bit worrisome.
Hmmmmm. Maybe a better way is to make it reversed?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err. Actually if we are going to check globals then we don't need GlobalErrorEventHandlers at all. The emitter can just add an overridden
onerrorproperty directly to each global interface.