diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index f543d0f63..2140495e2 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -17222,7 +17222,7 @@ interface GlobalEventHandlersEventMap { "change": Event; "click": PointerEvent; "close": Event; - "command": Event; + "command": CommandEvent; "compositionend": CompositionEvent; "compositionstart": CompositionEvent; "compositionupdate": CompositionEvent; @@ -17348,7 +17348,7 @@ interface GlobalEventHandlers { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/close_event) */ onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/command_event) */ - oncommand: ((this: GlobalEventHandlers, ev: Event) => any) | null; + oncommand: ((this: GlobalEventHandlers, ev: CommandEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/contextlost_event) */ oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/contextmenu_event) */ @@ -44734,7 +44734,7 @@ declare var onclick: ((this: Window, ev: PointerEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/close_event) */ declare var onclose: ((this: Window, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/command_event) */ -declare var oncommand: ((this: Window, ev: Event) => any) | null; +declare var oncommand: ((this: Window, ev: CommandEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/contextlost_event) */ declare var oncontextlost: ((this: Window, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/contextmenu_event) */ diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index 2594d311f..45ec977fd 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -17208,7 +17208,7 @@ interface GlobalEventHandlersEventMap { "change": Event; "click": PointerEvent; "close": Event; - "command": Event; + "command": CommandEvent; "compositionend": CompositionEvent; "compositionstart": CompositionEvent; "compositionupdate": CompositionEvent; @@ -17334,7 +17334,7 @@ interface GlobalEventHandlers { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/close_event) */ onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/command_event) */ - oncommand: ((this: GlobalEventHandlers, ev: Event) => any) | null; + oncommand: ((this: GlobalEventHandlers, ev: CommandEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/contextlost_event) */ oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/contextmenu_event) */ @@ -44708,7 +44708,7 @@ declare var onclick: ((this: Window, ev: PointerEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/close_event) */ declare var onclose: ((this: Window, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/command_event) */ -declare var oncommand: ((this: Window, ev: Event) => any) | null; +declare var oncommand: ((this: Window, ev: CommandEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/contextlost_event) */ declare var oncontextlost: ((this: Window, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/contextmenu_event) */ diff --git a/baselines/ts5.6/dom.generated.d.ts b/baselines/ts5.6/dom.generated.d.ts index a9f3c2fc4..aca3db87f 100644 --- a/baselines/ts5.6/dom.generated.d.ts +++ b/baselines/ts5.6/dom.generated.d.ts @@ -17219,7 +17219,7 @@ interface GlobalEventHandlersEventMap { "change": Event; "click": PointerEvent; "close": Event; - "command": Event; + "command": CommandEvent; "compositionend": CompositionEvent; "compositionstart": CompositionEvent; "compositionupdate": CompositionEvent; @@ -17345,7 +17345,7 @@ interface GlobalEventHandlers { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/close_event) */ onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/command_event) */ - oncommand: ((this: GlobalEventHandlers, ev: Event) => any) | null; + oncommand: ((this: GlobalEventHandlers, ev: CommandEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/contextlost_event) */ oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/contextmenu_event) */ @@ -44731,7 +44731,7 @@ declare var onclick: ((this: Window, ev: PointerEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/close_event) */ declare var onclose: ((this: Window, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/command_event) */ -declare var oncommand: ((this: Window, ev: Event) => any) | null; +declare var oncommand: ((this: Window, ev: CommandEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/contextlost_event) */ declare var oncontextlost: ((this: Window, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/contextmenu_event) */ diff --git a/baselines/ts5.9/dom.generated.d.ts b/baselines/ts5.9/dom.generated.d.ts index 83e861452..b0dba0280 100644 --- a/baselines/ts5.9/dom.generated.d.ts +++ b/baselines/ts5.9/dom.generated.d.ts @@ -17219,7 +17219,7 @@ interface GlobalEventHandlersEventMap { "change": Event; "click": PointerEvent; "close": Event; - "command": Event; + "command": CommandEvent; "compositionend": CompositionEvent; "compositionstart": CompositionEvent; "compositionupdate": CompositionEvent; @@ -17345,7 +17345,7 @@ interface GlobalEventHandlers { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/close_event) */ onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/command_event) */ - oncommand: ((this: GlobalEventHandlers, ev: Event) => any) | null; + oncommand: ((this: GlobalEventHandlers, ev: CommandEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/contextlost_event) */ oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/contextmenu_event) */ @@ -44731,7 +44731,7 @@ declare var onclick: ((this: Window, ev: PointerEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/close_event) */ declare var onclose: ((this: Window, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/command_event) */ -declare var oncommand: ((this: Window, ev: Event) => any) | null; +declare var oncommand: ((this: Window, ev: CommandEvent) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/contextlost_event) */ declare var oncontextlost: ((this: Window, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/contextmenu_event) */ diff --git a/inputfiles/patches/events.kdl b/inputfiles/patches/events.kdl index 4d11ba797..9081bbf22 100644 --- a/inputfiles/patches/events.kdl +++ b/inputfiles/patches/events.kdl @@ -17,6 +17,7 @@ interface-mixin GlobalEventHandlers { event beforetoggle type=ToggleEvent event blur type=FocusEvent event click type=PointerEvent + event command type=CommandEvent event compositionend type=CompositionEvent event compositionstart type=CompositionEvent event compositionupdate type=CompositionEvent diff --git a/unittests/files/command-event.ts b/unittests/files/command-event.ts new file mode 100644 index 000000000..89e8b48d5 --- /dev/null +++ b/unittests/files/command-event.ts @@ -0,0 +1,35 @@ +document.body.addEventListener("command", (event) => { + const commandEvent: CommandEvent = event; + const command: string = event.command; + const source: Element | null = event.source; +}); + +document.body.oncommand = (event) => { + const commandEvent: CommandEvent = event; + const command: string = event.command; +}; + +document.addEventListener("command", (event) => { + const commandEvent: CommandEvent = event; + const command: string = event.command; +}); + +window.oncommand = (event) => { + const commandEvent: CommandEvent = event; + const command: string = event.command; +}; + +oncommand = (event) => { + const commandEvent: CommandEvent = event; + const command: string = event.command; +}; + +window.addEventListener("command", (event) => { + const commandEvent: CommandEvent = event; + const source: Element | null = event.source; +}); + +addEventListener("command", (event) => { + const commandEvent: CommandEvent = event; + const command: string = event.command; +});