| 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 05fc09a5052ce3fc62606e0113185202a960e1f9..04ed9e673bb499a962ad704800b21fd580044e71 100644
|
| --- a/sdk/lib/html/dart2js/html_dart2js.dart
|
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart
|
| @@ -42766,6 +42766,21 @@ _makeCallbackMethod3(callback) {
|
| convertDartClosureToJS(callback, 4));
|
| }
|
|
|
| +/// Checks whether the given [element] correctly extends from the native class
|
| +/// with the given [baseClassName]. This method will throw if the base class
|
| +/// doesn't match, except when the element extends from `template` and it's base
|
| +/// class is `HTMLUnknownElement`. This exclusion is needed to support extension
|
| +/// of template elements (used heavily in Polymer 1.0) on IE11 when using the
|
| +/// webcomponents-lite.js polyfill.
|
| +void _checkExtendsNativeClassOrTemplate(
|
| + Element element, String extendsTag, String baseClassName) {
|
| + if (!JS('bool', '(# instanceof window[#])', element, baseClassName) &&
|
| + !((extendsTag == 'template' &&
|
| + JS('bool', '(# instanceof window["HTMLUnknownElement"])', element)))) {
|
| + throw new UnsupportedError('extendsTag does not match base native class');
|
| + }
|
| +}
|
| +
|
| void _registerCustomElement(context, document, String tag, Type type,
|
| String extendsTagName) {
|
| // Function follows the same pattern as the following JavaScript code for
|
| @@ -42809,10 +42824,8 @@ void _registerCustomElement(context, document, String tag, Type type,
|
| '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 element = document.createElement(extendsTagName);
|
| + _checkExtendsNativeClassOrTemplate(element, extendsTagName, baseClassName);
|
| }
|
|
|
| var baseConstructor = JS('=Object', '#[#]', context, baseClassName);
|
| @@ -42882,14 +42895,7 @@ class _JSElementUpgrader implements ElementUpgrader {
|
| _nativeType = HtmlElement;
|
| } else {
|
| var element = document.createElement(extendsTag);
|
| - if (!JS('bool', '(# instanceof window[#])', element, baseClassName) &&
|
| - // Exception to support template elements (extended for core pieces of
|
| - // Polymer 1.0) when using the webcomponents-lite.js polyfill on IE11:
|
| - !((extendsTag == 'template' &&
|
| - JS('bool', '(# instanceof window["HTMLUnknownElement"])', element)))) {
|
| - throw new UnsupportedError(
|
| - 'extendsTag does not match base native class');
|
| - }
|
| + _checkExtendsNativeClassOrTemplate(element, extendsTag, baseClassName);
|
| _nativeType = element.runtimeType;
|
| }
|
|
|
|
|