| Index: sdk/lib/html/dart2js/html_dart2js.dart
|
| diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
|
| index a1ebcf2b23a15367c2fbb05781a2c7e5364711f4..175cf5c898f4bc59fa8532a507b5e9e77dfec0e2 100644
|
| --- a/sdk/lib/html/dart2js/html_dart2js.dart
|
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart
|
| @@ -8800,8 +8800,8 @@ abstract class Element extends Node implements ParentNode, ChildNode native "Ele
|
| *
|
| * * [isTagSupported]
|
| */
|
| - factory Element.tag(String tag) =>
|
| - _ElementFactoryProvider.createElement_tag(tag);
|
| + factory Element.tag(String tag, [String typeExtention]) =>
|
| + _ElementFactoryProvider.createElement_tag(tag, typeExtention);
|
|
|
| /// Creates a new `<a>` element.
|
| ///
|
| @@ -9118,7 +9118,7 @@ abstract class Element extends Node implements ParentNode, ChildNode native "Ele
|
| * The tag should be a valid HTML tag name.
|
| */
|
| static bool isTagSupported(String tag) {
|
| - var e = _ElementFactoryProvider.createElement_tag(tag);
|
| + var e = _ElementFactoryProvider.createElement_tag(tag, null);
|
| return e is Element && !(e is UnknownElement);
|
| }
|
|
|
| @@ -10554,9 +10554,9 @@ class _ElementFactoryProvider {
|
| @DomName('Document.createElement')
|
| // Optimization to improve performance until the dart2js compiler inlines this
|
| // method.
|
| - static dynamic createElement_tag(String tag) =>
|
| - // Firefox may return a JS function for some types (Embed, Object).
|
| - JS('Element|=Object', 'document.createElement(#)', tag);
|
| + static dynamic createElement_tag(String tag, String typeExtension) =>
|
| + // Firefox may return a JS function for some types (Embed, Object).
|
| + JS('Element|=Object', 'document.createElement(#, #)', tag, typeExtension);
|
| }
|
|
|
|
|
| @@ -30810,6 +30810,79 @@ _makeCreatedCallbackMethod() {
|
| convertDartClosureToJS(_callCreated, 1));
|
| }
|
|
|
| +const _typeNameToTag = const {
|
| + 'HTMLAnchorElement': 'a',
|
| + 'HTMLAppletElement': 'applet',
|
| + 'HTMLAreaElement': 'area',
|
| + 'HTMLAudioElement': 'audio',
|
| + 'HTMLBRElement': 'br',
|
| + 'HTMLBaseElement': 'base',
|
| + 'HTMLBaseFontElement': 'basefont',
|
| + 'HTMLBodyElement': 'body',
|
| + 'HTMLButtonElement': 'button',
|
| + 'HTMLCanvasElement': 'canvas',
|
| + 'HTMLDListElement': 'dl',
|
| + 'HTMLDataListElement': 'datalist',
|
| + 'HTMLDirectoryElement': 'dir',
|
| + 'HTMLDivElement': 'div',
|
| + 'HTMLEmbedElement': 'embed',
|
| + 'HTMLFieldSetElement': 'fieldset',
|
| + 'HTMLFontElement': 'font',
|
| + 'HTMLFormElement': 'form',
|
| + 'HTMLFrameElement': 'frame',
|
| + 'HTMLFrameSetElement': 'frameset',
|
| + 'HTMLHRElement': 'hr',
|
| + 'HTMLHeadElement': 'head',
|
| + 'HTMLHeadingElement': 'h1',
|
| + 'HTMLHtmlElement': 'html',
|
| + 'HTMLIFrameElement': 'iframe',
|
| + 'HTMLImageElement': 'image',
|
| + 'HTMLImageElement': 'img',
|
| + 'HTMLInputElement': 'input',
|
| + 'HTMLKeygenElement': 'keygen',
|
| + 'HTMLLIElement': 'li',
|
| + 'HTMLLabelElement': 'label',
|
| + 'HTMLLegendElement': 'legend',
|
| + 'HTMLLinkElement': 'link',
|
| + 'HTMLMapElement': 'map',
|
| + 'HTMLMarqueeElement': 'marquee',
|
| + 'HTMLMenuElement': 'menu',
|
| + 'HTMLMetaElement': 'meta',
|
| + 'HTMLMeterElement': 'meter',
|
| + 'HTMLModElement': 'del',
|
| + 'HTMLModElement': 'ins',
|
| + 'HTMLOListElement': 'ol',
|
| + 'HTMLObjectElement': 'object',
|
| + 'HTMLOptGroupElement': 'optgroup',
|
| + 'HTMLOptionElement': 'option',
|
| + 'HTMLOutputElement': 'output',
|
| + 'HTMLParagraphElement': 'p',
|
| + 'HTMLParamElement': 'param',
|
| + 'HTMLPreElement': 'pre',
|
| + 'HTMLProgressElement': 'progress',
|
| + 'HTMLQuoteElement': 'blockquote',
|
| + 'HTMLQuoteElement': 'q',
|
| + 'HTMLScriptElement': 'script',
|
| + 'HTMLSelectElement': 'select',
|
| + 'HTMLShadowElement': 'shadow',
|
| + 'HTMLSourceElement': 'source',
|
| + 'HTMLSpanElement': 'span',
|
| + 'HTMLStyleElement': 'style',
|
| + 'HTMLTableCaptionElement': 'caption',
|
| + 'HTMLTableCellElement': 'td',
|
| + 'HTMLTableColElement': 'col',
|
| + 'HTMLTableElement': 'table',
|
| + 'HTMLTableRowElement': 'tr',
|
| + 'HTMLTableSectionElement': 'tbody',
|
| + 'HTMLTableSectionElement': 'tfoot',
|
| + 'HTMLTableSectionElement': 'thead',
|
| + 'HTMLTextAreaElement': 'textarea',
|
| + 'HTMLTitleElement': 'title',
|
| + 'HTMLTrackElement': 'track',
|
| + 'HTMLUListElement': 'ul',
|
| + 'HTMLVideoElement': 'video',
|
| +};
|
| +
|
| void _registerCustomElement(context, document, String tag, Type type) {
|
| // Function follows the same pattern as the following JavaScript code for
|
| // registering a custom element.
|
| @@ -30852,8 +30925,15 @@ void _registerCustomElement(context, document, String tag, Type type) {
|
|
|
| setNativeSubclassDispatchRecord(proto, interceptor);
|
|
|
| - JS('void', '#.register(#, #)',
|
| - document, tag, JS('', '{prototype: #}', proto));
|
| + var options = JS('=Object', '{prototype: #}', proto);
|
| +
|
| + if (baseClassName != 'HTMLElement') {
|
| + if (_typeNameToTag.containsKey(baseClassName)) {
|
| + JS('=Object', '#.extends = #', options, _typeNameToTag[baseClassName]);
|
| + }
|
| + }
|
| +
|
| + JS('void', '#.register(#, #)', document, tag, options);
|
| }
|
| // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
|
|