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

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

Issue 26089002: Call .created constructor on dart2js custom elements (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 | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/templates/html/dart2js/html_dart2js.darttemplate » ('j') | 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 a3fa0bf1360ec05df789d057c278c12991f59646..8edecc44a8edc2fd472ef40f9c7234c5a7b5dab6 100644
--- a/tools/dom/src/dart2js_CustomElementSupport.dart
+++ b/tools/dom/src/dart2js_CustomElementSupport.dart
@@ -4,8 +4,10 @@
part of dart.dom.html;
-_callCreated(receiver) {
- return receiver.createdCallback();
+_callConstructor(constructor) {
+ return (receiver) {
+ return JS('', '#(#)', constructor, receiver);
+ };
}
_callEnteredView(receiver) {
@@ -84,6 +86,11 @@ void _registerCustomElement(context, document, String tag, Type type,
throw new ArgumentError(type);
}
+ var constructor = findConstructorForWebComponentType(type, 'created');
+ if (constructor == null) {
+ throw new ArgumentError("$type has no constructor called 'created'");
+ }
+
// Workaround for 13190- use an article element to ensure that HTMLElement's
// interceptor is resolved correctly.
getNativeInterceptor(new Element.tag('article'));
@@ -99,7 +106,8 @@ void _registerCustomElement(context, document, String tag, Type type,
var properties = JS('=Object', '{}');
JS('void', '#.createdCallback = #', properties,
- JS('=Object', '{value: #}', _makeCallbackMethod(_callCreated)));
+ JS('=Object', '{value: #}',
+ _makeCallbackMethod(_callConstructor(constructor))));
JS('void', '#.enteredViewCallback = #', properties,
JS('=Object', '{value: #}', _makeCallbackMethod(_callEnteredView)));
JS('void', '#.leftViewCallback = #', properties,
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/templates/html/dart2js/html_dart2js.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698