Skip to content

Commit ed07bae

Browse files
authored
Merge pull request #503 from irrationalRock/issue-242025
Fixed #242025 - Added nonce
2 parents 8d94cce + 81fa7cb commit ed07bae

6 files changed

+99
-7
lines changed

baselines/dom.generated.d.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@ interface FocusNavigationOrigin {
464464
originWidth?: number;
465465
}
466466

467+
interface FocusOptions {
468+
preventScroll?: boolean;
469+
}
470+
467471
interface GainOptions extends AudioNodeOptions {
468472
gain?: number;
469473
}
@@ -5162,6 +5166,12 @@ interface ElementCSSInlineStyle {
51625166
readonly style: CSSStyleDeclaration;
51635167
}
51645168

5169+
interface ElementContentEditable {
5170+
contentEditable: string;
5171+
inputMode: string;
5172+
readonly isContentEditable: boolean;
5173+
}
5174+
51655175
interface ElementCreationOptions {
51665176
is?: string;
51675177
}
@@ -6131,7 +6141,7 @@ interface HTMLElementEventMap extends ElementEventMap {
61316141
"waiting": Event;
61326142
}
61336143

6134-
interface HTMLElement extends Element, ElementCSSInlineStyle {
6144+
interface HTMLElement extends Element, ElementCSSInlineStyle, HTMLOrSVGElement {
61356145
accessKey: string;
61366146
contentEditable: string;
61376147
readonly dataset: DOMStringMap;
@@ -6221,7 +6231,7 @@ interface HTMLElement extends Element, ElementCSSInlineStyle {
62216231
blur(): void;
62226232
click(): void;
62236233
dragDrop(): boolean;
6224-
focus(): void;
6234+
focus(options?: FocusOptions): void;
62256235
msGetInputContext(): MSInputMethodContext;
62266236
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
62276237
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -7695,6 +7705,14 @@ declare var HTMLOptionsCollection: {
76957705
new(): HTMLOptionsCollection;
76967706
};
76977707

7708+
interface HTMLOrSVGElement {
7709+
readonly dataset: DOMStringMap;
7710+
nonce: string;
7711+
tabIndex: number;
7712+
blur(): void;
7713+
focus(options?: FocusOptions): void;
7714+
}
7715+
76987716
interface HTMLOutputElement extends HTMLElement {
76997717
defaultValue: string;
77007718
readonly form: HTMLFormElement | null;

inputfiles/addedTypes.json

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,43 @@
1212
}
1313
}
1414
},
15+
"HTMLOrSVGElement": {
16+
"name": "HTMLOrSVGElement",
17+
"properties": {
18+
"property": {
19+
"nonce": {
20+
"name": "nonce",
21+
"type": "DOMString"
22+
},
23+
"tabIndex": {
24+
"name": "tabIndex",
25+
"type": "long"
26+
},
27+
"dataset": {
28+
"name": "dataset",
29+
"read-only": 1,
30+
"type": "DOMStringMap"
31+
}
32+
}
33+
},
34+
"methods": {
35+
"method": {
36+
"blur": {
37+
"name": "blur",
38+
"override-signatures": [
39+
"blur(): void"
40+
]
41+
},
42+
"focus": {
43+
"name": "focus",
44+
"override-signatures": [
45+
"focus(options?: FocusOptions): void"
46+
]
47+
}
48+
}
49+
},
50+
"no-interface-object": "1"
51+
},
1552
"ParentNode": {
1653
"name": "ParentNode",
1754
"exposed": "Window",
@@ -1961,7 +1998,7 @@
19611998
},
19621999
"element": [
19632000
{
1964-
2001+
19652002
"name": "input"
19662003
}
19672004
]
@@ -2112,7 +2149,7 @@
21122149
{
21132150
"name": "caption"
21142151
}
2115-
]
2152+
]
21162153
},
21172154
"HTMLTableCellElement": {
21182155
"element": [
@@ -2122,7 +2159,7 @@
21222159
{
21232160
"name": "th"
21242161
}
2125-
]
2162+
]
21262163
},
21272164
"HTMLTableColElement": {
21282165
"element": [
@@ -2151,7 +2188,7 @@
21512188
{
21522189
"name": "table"
21532190
}
2154-
]
2191+
]
21552192
},
21562193
"HTMLTableHeaderCellElement": {
21572194
"name": "HTMLTableHeaderCellElement",
@@ -2176,7 +2213,7 @@
21762213
{
21772214
"name": "tr"
21782215
}
2179-
]
2216+
]
21802217
},
21812218
"HTMLTableSectionElement": {
21822219
"element": [
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"click": "Acts as if the element was clicked.",
3+
"document-hasfocus": "Returns true if key events are being routed through or to the document; otherwise, returns\nfalse. Roughly speaking, this corresponds to the document, or a document nested inside this\none, being focused.",
4+
"window-focus": "Moves the focus to the window's browsing context, if any.",
5+
"focus": "Moves the focus to the element.\nIf the element is a browsing context container, moves the focus to the\nnested browsing context instead.\nBy default, this method also scrolls the element into view. Providing the preventScroll option and setting it to true\nprevents this behavior.",
6+
"blur": "Moves the focus to the viewport. Use of this method is discouraged; if you want\nto focus the viewport, call the focus() method on\nthe Document's document element.\nDo not use this method to hide the focus ring if you find the focus ring unsightly. Instead,\nuse a CSS rule to override the 'outline' property, and provide a different way to\nshow what element is focused. Be aware that if an alternative focusing style isn't made\navailable, the page will be significantly less usable for people who primarily navigate pages\nusing a keyboard, or those with reduced vision who use focus outlines to help them navigate the\npage.\nFor example, to hide the outline from links and instead use a yellow background to indicate\nfocus, you could use:\n:link:focus, :visited:focus { outline: none; background: yellow; color: black; }",
7+
"contenteditable": "Returns \"true\", \"false\", or \"inherit\", based on the state of the contenteditable attribute.\nCan be set, to change that state.\nThrows a \"SyntaxError\" DOMException if the new value\nisn't one of those strings.",
8+
"iscontenteditable": "Returns true if the element is editable; otherwise, returns false.",
9+
"spellcheck": "Returns true if the element is to have its spelling and grammar checked; otherwise, returns\nfalse.\nCan be set, to override the default and set the spellcheck content attribute.",
10+
"autocapitalize": "Returns the current autocapitalization state for the element, or an empty string if it hasn't\nbeen set. Note that for input and textarea elements that inherit their\nstate from a form element, this will return the autocapitalization state of the\nform element, but for an element in an editable region, this will not return the\nautocapitalization state of the editing host (unless this element is, in fact, the editing\nhost).\nCan be set, to set the autocapitalize content\nattribute (and thereby change the autocapitalization behavior for the element)."
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dictionary FocusOptions {
2+
boolean preventScroll = false;
3+
};
4+
5+
interface mixin ElementContentEditable {
6+
[CEReactions] attribute DOMString contentEditable;
7+
readonly attribute boolean isContentEditable;
8+
[CEReactions] attribute DOMString inputMode;
9+
};

inputfiles/idlSources.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@
113113
"url": "https://html.spec.whatwg.org/multipage/webstorage.html",
114114
"title": "HTML - Web storage"
115115
},
116+
{
117+
"url": "https://html.spec.whatwg.org/multipage/interaction.html",
118+
"title": "HTML - User interaction"
119+
},
116120
{
117121
"url": "https://www.w3.org/TR/IndexedDB-2/",
118122
"title": "Indexed Database"

inputfiles/overridingTypes.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,19 @@
897897
}
898898
}
899899
},
900+
"HTMLElement": {
901+
"implements": ["HTMLOrSVGElement"],
902+
"methods": {
903+
"method": {
904+
"focus": {
905+
"name": "focus",
906+
"override-signatures": [
907+
"focus(options?: FocusOptions): void"
908+
]
909+
}
910+
}
911+
}
912+
},
900913
"SVGElement": {
901914
"name": "SVGElement",
902915
"properties": {

0 commit comments

Comments
 (0)