Skip to content

Commit c6e1173

Browse files
authored
Merge pull request #560 from Microsoft/fixRWCBreaks
Fix lib breaks
2 parents c0ee38c + ba2728a commit c6e1173

File tree

7 files changed

+102
-53
lines changed

7 files changed

+102
-53
lines changed

baselines/dom.generated.d.ts

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3930,7 +3930,7 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
39303930
/**
39313931
* Specifies the beginning and end of the document body.
39323932
*/
3933-
body: HTMLElement | null;
3933+
body: HTMLElement;
39343934
/**
39353935
* Returns document's encoding.
39363936
*/
@@ -4096,6 +4096,7 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
40964096
/** @deprecated */
40974097
captureEvents(): void;
40984098
caretPositionFromPoint(x: number, y: number): CaretPosition | null;
4099+
caretRangeFromPoint(x: number, y: number): Range;
40994100
/** @deprecated */
41004101
clear(): void;
41014102
/**
@@ -4320,7 +4321,7 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
43204321
* @param filter A custom NodeFilter function to use.
43214322
* @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.
43224323
*/
4323-
createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker;
4324+
createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null, entityReferenceExpansion?: boolean): TreeWalker;
43244325
/**
43254326
* Returns the element for the specified x coordinate and the specified y coordinate.
43264327
* @param x The x-offset
@@ -4364,68 +4365,68 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
43644365
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
43654366
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
43664367
/**
4367-
* Returns a Boolean value that indicates whether the specified command is in the indeterminate state.
4368-
* @param commandId String that specifies a command identifier.
4369-
*/
4370-
queryCommandIndeterm(commandId: string): boolean;
4371-
/**
4372-
* Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.
4368+
* If namespace and localName are
4369+
* "*" returns a HTMLCollection of all descendant elements.
4370+
* If only namespace is "*" returns a HTMLCollection of all descendant elements whose local name is localName.
4371+
* If only localName is "*" returns a HTMLCollection of all descendant elements whose namespace is namespace.
4372+
* Otherwise, returns a HTMLCollection of all descendant elements whose namespace is namespace and local name is localName.
43734373
*/
4374+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
4375+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
4376+
getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf<Element>;
43744377
/**
4375-
* Returns a Boolean value that indicates whether the current command is supported on the current range.
4376-
* @param commandId Specifies a command identifier.
4378+
* Gets a value indicating whether the object currently has focus.
43774379
*/
4378-
queryCommandSupported(commandId: string): boolean;
4380+
hasFocus(): boolean;
4381+
importNode<T extends Node>(importedNode: T, deep: boolean): T;
43794382
/**
4380-
* Returns the current value of the document, range, or current selection for the given command.
4381-
* @param commandId String that specifies a command identifier.
4383+
* Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
4384+
* @param url Specifies a MIME type for the document.
4385+
* @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.
4386+
* @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported.
4387+
* @param replace Specifies whether the existing entry for the document is replaced in the history list.
43824388
*/
4383-
queryCommandValue(commandId: string): string;
4389+
open(url?: string, name?: string, features?: string, replace?: boolean): Document;
43844390
/**
43854391
* Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.
43864392
* @param commandId Specifies a command identifier.
43874393
*/
43884394
queryCommandEnabled(commandId: string): boolean;
43894395
/**
4390-
* Gets a value indicating whether the object currently has focus.
4396+
* Returns a Boolean value that indicates whether the specified command is in the indeterminate state.
4397+
* @param commandId String that specifies a command identifier.
43914398
*/
4392-
hasFocus(): boolean;
4399+
queryCommandIndeterm(commandId: string): boolean;
43934400
/**
43944401
* Returns a Boolean value that indicates the current state of the command.
43954402
* @param commandId String that specifies a command identifier.
43964403
*/
43974404
queryCommandState(commandId: string): boolean;
43984405
/**
4399-
* Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
4400-
* @param content The text and HTML tags to write.
4406+
* Returns a Boolean value that indicates whether the current command is supported on the current range.
4407+
* @param commandId Specifies a command identifier.
44014408
*/
4402-
writeln(...text: string[]): void;
4409+
queryCommandSupported(commandId: string): boolean;
4410+
/**
4411+
* Returns the current value of the document, range, or current selection for the given command.
4412+
* @param commandId String that specifies a command identifier.
4413+
*/
4414+
queryCommandValue(commandId: string): string;
4415+
/** @deprecated */
4416+
releaseEvents(): void;
44034417
/**
44044418
* Writes one or more HTML expressions to a document in the specified window.
44054419
* @param content Specifies the text and HTML tags to write.
44064420
*/
44074421
write(...text: string[]): void;
44084422
/**
4409-
* Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
4410-
* @param url Specifies a MIME type for the document.
4411-
* @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.
4412-
* @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported.
4413-
* @param replace Specifies whether the existing entry for the document is replaced in the history list.
4423+
* Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
4424+
* @param content The text and HTML tags to write.
44144425
*/
4415-
open(url?: string, name?: string, features?: string, replace?: boolean): Document;
4426+
writeln(...text: string[]): void;
44164427
/**
4417-
* If namespace and localName are
4418-
* "*" returns a HTMLCollection of all descendant elements.
4419-
* If only namespace is "*" returns a HTMLCollection of all descendant elements whose local name is localName.
4420-
* If only localName is "*" returns a HTMLCollection of all descendant elements whose namespace is namespace.
4421-
* Otherwise, returns a HTMLCollection of all descendant elements whose namespace is namespace and local name is localName.
4428+
* Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.
44224429
*/
4423-
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
4424-
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
4425-
getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf<Element>;
4426-
importNode<T extends Node>(importedNode: T, deep: boolean): T;
4427-
/** @deprecated */
4428-
releaseEvents(): void;
44294430
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
44304431
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
44314432
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -4846,6 +4847,7 @@ interface Event {
48464847
*/
48474848
readonly isTrusted: boolean;
48484849
returnValue: boolean;
4850+
readonly srcElement: Element | null;
48494851
/**
48504852
* Returns the object to which event is dispatched (its target).
48514853
*/
@@ -5335,7 +5337,7 @@ interface GlobalEventHandlers {
53355337
* Fires when an error occurs during object loading.
53365338
* @param ev The event.
53375339
*/
5338-
onerror: ((this: GlobalEventHandlers, ev: ErrorEvent) => any) | null;
5340+
onerror: ErrorEventHandler;
53395341
/**
53405342
* Fires when the object receives focus.
53415343
* @param ev The event.
@@ -9282,7 +9284,7 @@ interface Location {
92829284
/**
92839285
* Reloads the current page.
92849286
*/
9285-
reload(): void;
9287+
reload(forcedReload?: boolean): void;
92869288
/**
92879289
* Removes the current page from the session history and navigates to the given URL.
92889290
*/
@@ -10256,6 +10258,7 @@ interface Node extends EventTarget {
1025610258
* Returns the last child.
1025710259
*/
1025810260
readonly lastChild: ChildNode | null;
10261+
readonly namespaceURI: string | null;
1025910262
/**
1026010263
* Returns the next sibling.
1026110264
*/
@@ -10293,7 +10296,7 @@ interface Node extends EventTarget {
1029310296
/**
1029410297
* Returns the parent element.
1029510298
*/
10296-
readonly parentElement: Element | null;
10299+
readonly parentElement: HTMLElement | null;
1029710300
/**
1029810301
* Returns the parent.
1029910302
*/
@@ -17365,7 +17368,7 @@ declare var onended: ((this: Window, ev: Event) => any) | null;
1736517368
* Fires when an error occurs during object loading.
1736617369
* @param ev The event.
1736717370
*/
17368-
declare var onerror: ((this: Window, ev: ErrorEvent) => any) | null;
17371+
declare var onerror: ErrorEventHandler;
1736917372
/**
1737017373
* Fires when the object receives focus.
1737117374
* @param ev The event.
@@ -17623,6 +17626,7 @@ type IDBKeyPath = string;
1762317626
type Transferable = ArrayBuffer | MessagePort | ImageBitmap;
1762417627
type RTCIceGatherCandidate = RTCIceCandidateDictionary | RTCIceCandidateComplete;
1762517628
type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
17629+
type MouseWheelEvent = WheelEvent;
1762617630
type WindowProxy = Window;
1762717631
type AlignSetting = "start" | "center" | "end" | "left" | "right";
1762817632
type AnimationPlayState = "idle" | "running" | "paused" | "finished";

baselines/webworker.generated.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,7 @@ interface Event {
10191019
*/
10201020
readonly isTrusted: boolean;
10211021
returnValue: boolean;
1022+
readonly srcElement: object | null;
10221023
/**
10231024
* Returns the object to which event is dispatched (its target).
10241025
*/

inputfiles/addedTypes.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2570,6 +2570,10 @@
25702570
"new-type": "RTCTransport",
25712571
"override-type": "RTCDtlsTransport | RTCSrtpSdesTransport"
25722572
},
2573+
{
2574+
"new-type": "MouseWheelEvent",
2575+
"type": "WheelEvent"
2576+
},
25732577
{
25742578
"new-type": "WindowProxy",
25752579
"type": "Window"

inputfiles/knownTypes.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979
"RsaOaepParams",
8080
"RsaPssParams",
8181
"Transferable",
82-
"VideoFacingModeEnum"
82+
"VideoFacingModeEnum",
83+
"MouseWheelEvent"
8384
],
8485
"Worker": [
8586
"AesCbcParams",

inputfiles/overridingTypes.json

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@
124124
"type": "TransitionEvent"
125125
}
126126
]
127+
},
128+
"properties": {
129+
"property": {
130+
"onerror": {
131+
"override-type": "ErrorEventHandler"
132+
}
133+
}
127134
}
128135
},
129136
"RandomSource": {
@@ -413,6 +420,17 @@
413420
"override-signatures": [
414421
"getElementsByName(elementName: string): NodeListOf<HTMLElement>"
415422
]
423+
},
424+
"createTreeWalker": {
425+
"override-signatures": [
426+
"createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null, entityReferenceExpansion?: boolean): TreeWalker"
427+
]
428+
},
429+
"caretRangeFromPoint": {
430+
"name": "caretRangeFromPoint",
431+
"override-signatures" :[
432+
"caretRangeFromPoint(x: number, y: number): Range"
433+
]
416434
}
417435
}
418436
},
@@ -459,7 +477,10 @@
459477
},
460478
"location": {
461479
"read-only": 0
462-
}
480+
},
481+
"body": {
482+
"nullable": false
483+
}
463484
}
464485
}
465486
},
@@ -506,7 +527,7 @@
506527
"override-type": "Node & ParentNode | null"
507528
},
508529
"parentElement": {
509-
"override-type": "Element | null"
530+
"override-type": "HTMLElement | null"
510531
},
511532
"childNodes": {
512533
"override-type": "NodeListOf<ChildNode>"
@@ -516,6 +537,11 @@
516537
},
517538
"lastChild": {
518539
"override-type": "ChildNode | null"
540+
},
541+
"namespaceURI": {
542+
"name":"namespaceURI",
543+
"read-only": 1,
544+
"override-type": "string | null"
519545
}
520546
}
521547
}
@@ -2155,7 +2181,15 @@
21552181
},
21562182
"Event": {
21572183
"name": "Event",
2158-
"override-exposed": "Window Worker"
2184+
"override-exposed": "Window Worker",
2185+
"properties": {
2186+
"property": {
2187+
"srcElement": {
2188+
"type": "Element",
2189+
"nullable": 1
2190+
}
2191+
}
2192+
}
21592193
},
21602194
"ReadableStream": {
21612195
"name": "ReadableStream",
@@ -2313,6 +2347,17 @@
23132347
"[index: number]: Element",
23142348
"[name: string]: any"
23152349
]
2350+
},
2351+
"Location": {
2352+
"methods": {
2353+
"method": {
2354+
"reload": {
2355+
"override-signatures": [
2356+
"reload(forcedReload?: boolean): void"
2357+
]
2358+
}
2359+
}
2360+
}
23162361
}
23172362
}
23182363
},
@@ -2497,4 +2542,4 @@
24972542
"typedefs": {
24982543
"typedef": []
24992544
}
2500-
}
2545+
}

inputfiles/removedTypes.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@
4949
}
5050
}
5151
},
52-
"Event": {
53-
"properties": {
54-
"property": {
55-
"srcElement": null
56-
}
57-
}
58-
},
5952
"FileReaderProgressEvent": null,
6053
"HTMLAreasCollection": null,
6154
"HTMLBodyElement": {

src/emitter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export function emitWebIDl(webidl: Browser.WebIdl, flavor: Flavor) {
168168
const eventType = eType === "Event" || dependsOn(eType, "Event") ? eType : defaultEventType;
169169
return { name: p.name, eventName, eventType };
170170
}));
171-
171+
172172
const iNameToConstList = arrayToMap(allInterfaces, i => i.name, i =>
173173
!i.constants ? [] : mapToArray(i.constants.constant));
174174

@@ -328,6 +328,7 @@ export function emitWebIDl(webidl: Browser.WebIdl, flavor: Flavor) {
328328
case "EventListener": return "EventListenerOrEventListenerObject";
329329
}
330330
if (flavor === Flavor.Web && objDomType === "Client") return "object";
331+
if (flavor === Flavor.Worker && objDomType === "Element") return "object";
331332
// Name of an interface / enum / dict. Just return itself
332333
if (allInterfacesMap[objDomType] ||
333334
allLegacyWindowAliases.includes(objDomType) ||

0 commit comments

Comments
 (0)