diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index cef316cd7..f51db41f5 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -464,6 +464,10 @@ interface FocusNavigationOrigin { originWidth?: number; } +interface FocusOptions { + preventScroll?: boolean; +} + interface GainOptions extends AudioNodeOptions { gain?: number; } @@ -5162,6 +5166,12 @@ interface ElementCSSInlineStyle { readonly style: CSSStyleDeclaration; } +interface ElementContentEditable { + contentEditable: string; + inputMode: string; + readonly isContentEditable: boolean; +} + interface ElementCreationOptions { is?: string; } @@ -6131,7 +6141,7 @@ interface HTMLElementEventMap extends ElementEventMap { "waiting": Event; } -interface HTMLElement extends Element, ElementCSSInlineStyle { +interface HTMLElement extends Element, ElementCSSInlineStyle, HTMLOrSVGElement { accessKey: string; contentEditable: string; readonly dataset: DOMStringMap; @@ -6221,7 +6231,7 @@ interface HTMLElement extends Element, ElementCSSInlineStyle { blur(): void; click(): void; dragDrop(): boolean; - focus(): void; + focus(options?: FocusOptions): void; msGetInputContext(): MSInputMethodContext; addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -7695,6 +7705,14 @@ declare var HTMLOptionsCollection: { new(): HTMLOptionsCollection; }; +interface HTMLOrSVGElement { + readonly dataset: DOMStringMap; + nonce: string; + tabIndex: number; + blur(): void; + focus(options?: FocusOptions): void; +} + interface HTMLOutputElement extends HTMLElement { defaultValue: string; readonly form: HTMLFormElement | null; diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index 0ecf28e4d..b079d76b6 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -12,6 +12,43 @@ } } }, + "HTMLOrSVGElement": { + "name": "HTMLOrSVGElement", + "properties": { + "property": { + "nonce": { + "name": "nonce", + "type": "DOMString" + }, + "tabIndex": { + "name": "tabIndex", + "type": "long" + }, + "dataset": { + "name": "dataset", + "read-only": 1, + "type": "DOMStringMap" + } + } + }, + "methods": { + "method": { + "blur": { + "name": "blur", + "override-signatures": [ + "blur(): void" + ] + }, + "focus": { + "name": "focus", + "override-signatures": [ + "focus(options?: FocusOptions): void" + ] + } + } + }, + "no-interface-object": "1" + }, "ParentNode": { "name": "ParentNode", "exposed": "Window", @@ -1961,7 +1998,7 @@ }, "element": [ { - + "name": "input" } ] @@ -2112,7 +2149,7 @@ { "name": "caption" } - ] + ] }, "HTMLTableCellElement": { "element": [ @@ -2122,7 +2159,7 @@ { "name": "th" } - ] + ] }, "HTMLTableColElement": { "element": [ @@ -2151,7 +2188,7 @@ { "name": "table" } - ] + ] }, "HTMLTableHeaderCellElement": { "name": "HTMLTableHeaderCellElement", @@ -2176,7 +2213,7 @@ { "name": "tr" } - ] + ] }, "HTMLTableSectionElement": { "element": [ diff --git a/inputfiles/idl/HTML - User interaction.commentmap.json b/inputfiles/idl/HTML - User interaction.commentmap.json new file mode 100644 index 000000000..b54f30e06 --- /dev/null +++ b/inputfiles/idl/HTML - User interaction.commentmap.json @@ -0,0 +1,11 @@ +{ + "click": "Acts as if the element was clicked.", + "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.", + "window-focus": "Moves the focus to the window's browsing context, if any.", + "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.", + "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; }", + "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.", + "iscontenteditable": "Returns true if the element is editable; otherwise, returns false.", + "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.", + "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)." +} diff --git a/inputfiles/idl/HTML - User interaction.widl b/inputfiles/idl/HTML - User interaction.widl new file mode 100644 index 000000000..0cc15d77a --- /dev/null +++ b/inputfiles/idl/HTML - User interaction.widl @@ -0,0 +1,9 @@ +dictionary FocusOptions { + boolean preventScroll = false; +}; + +interface mixin ElementContentEditable { + [CEReactions] attribute DOMString contentEditable; + readonly attribute boolean isContentEditable; + [CEReactions] attribute DOMString inputMode; +}; diff --git a/inputfiles/idlSources.json b/inputfiles/idlSources.json index 96c146c7a..3b9e97eab 100644 --- a/inputfiles/idlSources.json +++ b/inputfiles/idlSources.json @@ -113,6 +113,10 @@ "url": "https://html.spec.whatwg.org/multipage/webstorage.html", "title": "HTML - Web storage" }, + { + "url": "https://html.spec.whatwg.org/multipage/interaction.html", + "title": "HTML - User interaction" + }, { "url": "https://www.w3.org/TR/IndexedDB-2/", "title": "Indexed Database" diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index dd7661e31..b3b6de778 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -897,6 +897,19 @@ } } }, + "HTMLElement": { + "implements": ["HTMLOrSVGElement"], + "methods": { + "method": { + "focus": { + "name": "focus", + "override-signatures": [ + "focus(options?: FocusOptions): void" + ] + } + } + } + }, "SVGElement": { "name": "SVGElement", "properties": {