Skip to content

Makes the ontouch* events on window optional. #749

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

Merged
merged 1 commit into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6096,10 +6096,10 @@ interface GlobalEventHandlers {
*/
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
ontouchcancel: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchend: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchmove: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchstart: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
Expand Down Expand Up @@ -19886,10 +19886,10 @@ declare var onsuspend: ((this: Window, ev: Event) => any) | null;
*/
declare var ontimeupdate: ((this: Window, ev: Event) => any) | null;
declare var ontoggle: ((this: Window, ev: Event) => any) | null;
declare var ontouchcancel: ((this: Window, ev: TouchEvent) => any) | null;
declare var ontouchend: ((this: Window, ev: TouchEvent) => any) | null;
declare var ontouchmove: ((this: Window, ev: TouchEvent) => any) | null;
declare var ontouchstart: ((this: Window, ev: TouchEvent) => any) | null;
declare var ontouchcancel: ((this: Window, ev: TouchEvent) => any) | null | undefined;
declare var ontouchend: ((this: Window, ev: TouchEvent) => any) | null | undefined;
declare var ontouchmove: ((this: Window, ev: TouchEvent) => any) | null | undefined;
declare var ontouchstart: ((this: Window, ev: TouchEvent) => any) | null | undefined;
declare var ontransitioncancel: ((this: Window, ev: TransitionEvent) => any) | null;
declare var ontransitionend: ((this: Window, ev: TransitionEvent) => any) | null;
declare var ontransitionrun: ((this: Window, ev: TransitionEvent) => any) | null;
Expand Down
12 changes: 12 additions & 0 deletions inputfiles/overridingTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@
"property": {
"onerror": {
"override-type": "OnErrorEventHandler"
},
"ontouchcancel": {
"required": 0
},
"ontouchend": {
"required": 0
},
"ontouchmove": {
"required": 0
},
"ontouchstart": {
"required": 0
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,12 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
else {
pType = convertDomTypeToTsType(p);
}
const requiredModifier = p.required === undefined || p.required === 1 ? "" : "?";
const required = p.required === undefined || p.required === 1;
const requiredModifier = required || prefix ? "" : "?";
pType = p.nullable ? makeNullable(pType) : pType;
if (!required && prefix) {
pType += " | undefined"
}
const readOnlyModifier = p["read-only"] === 1 && prefix === "" ? "readonly " : "";
printer.printLine(`${prefix}${readOnlyModifier}${p.name}${requiredModifier}: ${pType};`);
}
Expand Down