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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.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:
Download patch
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fcfeafc96e23a253ac2faaf08deb0f86d9f2e559..9ceaa5bfb8e4c12321459bca2bf97a6d1cecae88 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -32931,7 +32931,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 | « no previous file | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698