Index: tools/dom/src/dart2js_CustomElementSupport.dart |
diff --git a/tools/dom/src/dart2js_CustomElementSupport.dart b/tools/dom/src/dart2js_CustomElementSupport.dart |
index 6f8aedb2e3352186ffb1583bd908cf845e8dc7df..00e17b2056908b648454da354508991d8e3935ce 100644 |
--- a/tools/dom/src/dart2js_CustomElementSupport.dart |
+++ b/tools/dom/src/dart2js_CustomElementSupport.dart |
@@ -75,7 +75,18 @@ void _registerCustomElement(context, document, String tag, Type type, |
if (baseClassName == null) { |
throw new ArgumentError(type); |
} |
- if (baseClassName == 'Element') baseClassName = 'HTMLElement'; |
+ |
+ if (extendsTagName == null) { |
+ if (baseClassName != 'HTMLElement') { |
+ throw new UnsupportedError('Class must provide extendsTag if base ' |
+ 'native class is not HTMLElement'); |
+ } |
+ } else { |
+ if (!JS('bool', '(#.createElement(#) instanceof window[#])', |
+ document, extendsTagName, baseClassName)) { |
+ throw new UnsupportedError('extendsTag does not match base native class'); |
+ } |
+ } |
var baseConstructor = JS('=Object', '#[#]', context, baseClassName); |