| Index: tools/dom/src/dart2js_CustomElementSupport.dart
|
| diff --git a/tools/dom/src/dart2js_CustomElementSupport.dart b/tools/dom/src/dart2js_CustomElementSupport.dart
|
| index 95c64b678f51a7821c8c6dffc510de769523f684..243f9beaf5cdaecd52c62556bf7a2c3a438712a2 100644
|
| --- a/tools/dom/src/dart2js_CustomElementSupport.dart
|
| +++ b/tools/dom/src/dart2js_CustomElementSupport.dart
|
| @@ -18,7 +18,32 @@ _makeCreatedCallbackMethod() {
|
| convertDartClosureToJS(_callCreated, 1));
|
| }
|
|
|
| -void _registerCustomElement(context, document, String tag, Type type) {
|
| +const _typeNameToTag = const {
|
| + 'HTMLAnchorElement': 'a',
|
| + 'HTMLAudioElement': 'audio',
|
| + 'HTMLButtonElement': 'button',
|
| + 'HTMLCanvasElement': 'canvas',
|
| + 'HTMLDivElement': 'div',
|
| + 'HTMLImageElement': 'img',
|
| + 'HTMLInputElement': 'input',
|
| + 'HTMLLIElement': 'li',
|
| + 'HTMLLabelElement': 'label',
|
| + 'HTMLMenuElement': 'menu',
|
| + 'HTMLMeterElement': 'meter',
|
| + 'HTMLOListElement': 'ol',
|
| + 'HTMLOptionElement': 'option',
|
| + 'HTMLOutputElement': 'output',
|
| + 'HTMLParagraphElement': 'p',
|
| + 'HTMLPreElement': 'pre',
|
| + 'HTMLProgressElement': 'progress',
|
| + 'HTMLSelectElement': 'select',
|
| + 'HTMLSpanElement': 'span',
|
| + 'HTMLUListElement': 'ul',
|
| + 'HTMLVideoElement': 'video',
|
| +};
|
| +
|
| +void _registerCustomElement(context, document, String tag, Type type,
|
| + String nativeTagName) {
|
| // Function follows the same pattern as the following JavaScript code for
|
| // registering a custom element.
|
| //
|
| @@ -60,6 +85,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 (nativeTagName != null) {
|
| + JS('=Object', '#.extends = #', options, nativeTagName);
|
| + } else if (_typeNameToTag.containsKey(baseClassName)) {
|
| + JS('=Object', '#.extends = #', options, _typeNameToTag[baseClassName]);
|
| + }
|
| + }
|
| +
|
| + JS('void', '#.register(#, #)', document, tag, options);
|
| }
|
|
|