Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: tools/dom/src/dart2js_CustomElementSupport.dart

Issue 34203002: Tightening up custom element registration for dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698