Skip to content

Add back element tag name map #329

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 2 commits into from
Nov 22, 2017
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
5 changes: 5 additions & 0 deletions TS.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@ module Emit =
Pt.Printl "}"
Pt.Printl ""

let EmitElementTagNameMap () =
Pt.Printl "interface ElementTagNameMap extends HTMLElementTagNameMap, SVGElementTagNameMap { }"
Copy link
Contributor

@falsandtru falsandtru Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should extend only HTMLElementTagNameMap. If not, we can't define other SVG elements such as SVGAElement by extending the interface. So ElementTagNameMap should be just an alias of HTMLElementTagNameMap. This is a reasonable compromise as you said.

extends HTMLElementTagNameMap { }

Copy link
Contributor

@falsandtru falsandtru Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And ElementTagNameMap should be marked as deprecated.

Pt.Printl ""

/// Emit overloads for the createEvent method
let EmitCreateEventOverloads (m: Browser.Method) =
if matchSingleParamMethodSignature m "createEvent" "Event" "string" then
Expand Down Expand Up @@ -1514,6 +1518,7 @@ module Emit =
if flavor <> Worker then
EmitHTMLElementTagNameMap()
EmitSVGElementTagNameMap()
EmitElementTagNameMap()
EmitNamedConstructors()

match GetGlobalPollutor flavor with
Expand Down
2 changes: 2 additions & 0 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15029,6 +15029,8 @@ interface SVGElementTagNameMap {
"view": SVGViewElement;
}

interface ElementTagNameMap extends HTMLElementTagNameMap, SVGElementTagNameMap { }

declare var Audio: { new(src?: string): HTMLAudioElement; };
declare var Image: { new(width?: number, height?: number): HTMLImageElement; };
declare var Option: { new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };
Expand Down
54 changes: 27 additions & 27 deletions inputfiles/addedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@
{
"kind": "interface",
"name": "ParentNode",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"name": "children",
Expand Down Expand Up @@ -1455,7 +1455,7 @@
{
"kind": "typedef",
"name": "ScrollRestoration",
"flavor": "DOM",
"flavor": "Web",
"type": "\"auto\" | \"manual\""
},
{
Expand All @@ -1475,7 +1475,7 @@
{
"kind": "interface",
"name": "DocumentOrShadowRoot",
"flavor": "DOM",
"flavor": "Web",
"methods": [
{
"name": "getSelection",
Expand Down Expand Up @@ -1513,7 +1513,7 @@
"kind": "interface",
"name": "ShadowRoot",
"extends": "DocumentOrShadowRoot, DocumentFragment",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"name": "host",
Expand Down Expand Up @@ -1557,7 +1557,7 @@
{
"kind": "interface",
"name": "ShadowRootInit",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"name": "mode",
Expand All @@ -1580,7 +1580,7 @@
"kind": "interface",
"name": "HTMLSlotElement",
"extends": "HTMLElement",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"name": "name",
Expand All @@ -1599,7 +1599,7 @@
{
"kind": "interface",
"name": "AssignedNodesOptions",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"name": "flatten?",
Expand Down Expand Up @@ -1631,7 +1631,7 @@
{
"kind": "interface",
"name": "ElementDefinitionOptions",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"name": "extends",
Expand All @@ -1642,7 +1642,7 @@
{
"kind": "interface",
"name": "CustomElementRegistry",
"flavor": "DOM",
"flavor": "Web",
"methods": [
{
"name": "define",
Expand Down Expand Up @@ -1717,7 +1717,7 @@
"kind": "method",
"interface": "DocumentFragment",
"name": "getElementById",
"flavor": "DOM",
"flavor": "Web",
"signatures": [
"getElementById(elementId: string): HTMLElement | null"
]
Expand Down Expand Up @@ -1851,7 +1851,7 @@
"new(): HTMLDialogElement"
],
"extends": "HTMLElement",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"name": "open",
Expand Down Expand Up @@ -1897,7 +1897,7 @@
"new(): HTMLMainElement"
],
"extends": "HTMLElement",
"flavor": "DOM"
"flavor": "Web"
},
{
"kind": "interface",
Expand All @@ -1906,7 +1906,7 @@
"new(): HTMLDetailsElement"
],
"extends": "HTMLElement",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"name": "open",
Expand All @@ -1921,12 +1921,12 @@
"new(): HTMLSummaryElement"
],
"extends": "HTMLElement",
"flavor": "DOM"
"flavor": "Web"
},
{
"kind": "interface",
"name": "EXT_blend_minmax",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"readonly": true,
Expand All @@ -1943,19 +1943,19 @@
{
"kind": "interface",
"name": "EXT_frag_depth",
"flavor": "DOM",
"flavor": "Web",
"properties": []
},
{
"kind": "interface",
"name": "EXT_shader_texture_lod",
"flavor": "DOM",
"flavor": "Web",
"properties": []
},
{
"kind": "interface",
"name": "EXT_sRGB",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"readonly": true,
Expand All @@ -1982,7 +1982,7 @@
{
"kind": "interface",
"name": "OES_vertex_array_object",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"readonly": true,
Expand Down Expand Up @@ -2020,13 +2020,13 @@
{
"kind": "interface",
"name": "WebGLVertexArrayObjectOES",
"flavor": "DOM",
"flavor": "Web",
"properties": []
},
{
"kind": "interface",
"name": "WEBGL_color_buffer_float",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"readonly": true,
Expand All @@ -2053,7 +2053,7 @@
{
"kind": "interface",
"name": "WEBGL_compressed_texture_astc",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"readonly": true,
Expand Down Expand Up @@ -2208,7 +2208,7 @@
{
"kind": "interface",
"name": "WEBGL_compressed_texture_s3tc_srgb",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"readonly": true,
Expand All @@ -2235,7 +2235,7 @@
{
"kind": "interface",
"name": "WEBGL_debug_shaders",
"flavor": "DOM",
"flavor": "Web",
"methods": [
{
"name": "getTranslatedShaderSource",
Expand All @@ -2248,7 +2248,7 @@
{
"kind": "interface",
"name": "WEBGL_draw_buffers",
"flavor": "DOM",
"flavor": "Web",
"properties": [
{
"readonly": true,
Expand Down Expand Up @@ -2433,7 +2433,7 @@
{
"kind": "interface",
"name": "WEBGL_lose_context",
"flavor": "DOM",
"flavor": "Web",
"methods": [
{
"name": "loseContext",
Expand All @@ -2453,7 +2453,7 @@
"kind": "method",
"interface": "HTMLFormElement",
"name": "reportValidity",
"flavor": "DOM",
"flavor": "Web",
"signatures": [
"reportValidity(): boolean"
]
Expand Down