Skip to content

Commit 8a6869c

Browse files
saschanazsandersn
authored andcommitted
update dom-parsing idl (#661)
1 parent e8ef1be commit 8a6869c

File tree

4 files changed

+26
-28
lines changed

4 files changed

+26
-28
lines changed

baselines/dom.generated.d.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -4819,7 +4819,7 @@ interface ElementEventMap {
48194819
}
48204820

48214821
/** Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. */
4822-
interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, Slotable, Animatable {
4822+
interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, Slotable, InnerHTML, Animatable {
48234823
readonly assignedSlot: HTMLSlotElement | null;
48244824
readonly attributes: NamedNodeMap;
48254825
/**
@@ -4841,7 +4841,6 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode,
48414841
* change it.
48424842
*/
48434843
id: string;
4844-
innerHTML: string;
48454844
/**
48464845
* Returns the local name.
48474846
*/
@@ -9397,6 +9396,10 @@ declare var ImageData: {
93979396
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
93989397
};
93999398

9399+
interface InnerHTML {
9400+
innerHTML: string;
9401+
}
9402+
94009403
/** provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport. */
94019404
interface IntersectionObserver {
94029405
readonly root: Element | null;
@@ -14602,9 +14605,8 @@ declare var ServiceWorkerRegistration: {
1460214605
new(): ServiceWorkerRegistration;
1460314606
};
1460414607

14605-
interface ShadowRoot extends DocumentFragment, DocumentOrShadowRoot {
14608+
interface ShadowRoot extends DocumentFragment, DocumentOrShadowRoot, InnerHTML {
1460614609
readonly host: Element;
14607-
innerHTML: string;
1460814610
readonly mode: ShadowRootMode;
1460914611
}
1461014612

inputfiles/addedTypes.json

-11
Original file line numberDiff line numberDiff line change
@@ -1026,17 +1026,6 @@
10261026
}
10271027
}
10281028
},
1029-
"ShadowRoot": {
1030-
"name": "ShadowRoot",
1031-
"properties": {
1032-
"property": {
1033-
"innerHTML": {
1034-
"name": "innerHTML",
1035-
"type": "DOMString"
1036-
}
1037-
}
1038-
}
1039-
},
10401029
"SpeechRecognition": {
10411030
"events": {
10421031
"event": [

inputfiles/idl/DOM Parsing and Serialization.widl

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
[Constructor, Exposed=Window]
2-
interface DOMParser {
3-
[NewObject] Document parseFromString(DOMString str, SupportedType type);
4-
};
2+
interface DOMParser {
3+
[NewObject] Document parseFromString(DOMString str, SupportedType type);
4+
};
55

6-
enum SupportedType {
7-
"text/html",
8-
"text/xml",
9-
"application/xml",
10-
"application/xhtml+xml",
11-
"image/svg+xml"
12-
};
6+
enum SupportedType {
7+
"text/html",
8+
"text/xml",
9+
"application/xml",
10+
"application/xhtml+xml",
11+
"image/svg+xml"
12+
};
1313

1414
[Constructor, Exposed=Window]
15-
interface XMLSerializer {
15+
interface XMLSerializer {
1616
DOMString serializeToString(Node root);
1717
};
1818

19-
partial interface Element {
19+
interface mixin InnerHTML {
2020
[CEReactions, TreatNullAs=EmptyString] attribute DOMString innerHTML;
21+
};
22+
23+
Element includes InnerHTML;
24+
ShadowRoot includes InnerHTML;
25+
26+
partial interface Element {
2127
[CEReactions, TreatNullAs=EmptyString] attribute DOMString outerHTML;
2228
[CEReactions] void insertAdjacentHTML(DOMString position, DOMString text);
2329
};

src/idlfetcher.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ function getCommentText(text: string) {
141141
* Remove common indentation:
142142
* <pre>
143143
* typedef Type = "type";
144+
*
144145
* dictionary Dictionary {
145146
* "member"
146147
* };
@@ -155,7 +156,7 @@ function trimCommonIndentation(text: string) {
155156
if (!lines[lines.length - 1].trim()) {
156157
lines.pop();
157158
}
158-
const commonIndentation = Math.min(...lines.map(getIndentation));
159+
const commonIndentation = Math.min(...lines.filter(line => line.trim()).map(getIndentation));
159160
return lines.map(line => line.slice(commonIndentation)).join("\n");
160161
}
161162

0 commit comments

Comments
 (0)