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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Side-by-side diff isn't available for this file because of its large size.
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:
Download patch
« no previous file with comments | « no previous file | tools/dom/src/dart2js_CustomElementSupport.dart » ('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 3641bda4c9364dafe2543784bc322b07f7f8f04f..c02dce44d2f73e2aeb267fa22c318e3b21b614a1 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -55,7 +55,7 @@ import 'dart:_js_helper' show
findDispatchTagForInterceptorClass, setNativeSubclassDispatchRecord;
import 'dart:_interceptors' show
Interceptor, JSExtendableArray, findInterceptorConstructorForType,
- getNativeInterceptor;
+ findConstructorForWebComponentType, getNativeInterceptor;
export 'dart:math' show Rectangle, Point;
@@ -32363,8 +32363,10 @@ _convertNativeToDart_XHR_Response(o) {
// BSD-style license that can be found in the LICENSE file.
-_callCreated(receiver) {
- return receiver.createdCallback();
+_callConstructor(constructor) {
+ return (receiver) {
+ return JS('', '#(#)', constructor, receiver);
+ };
}
_callEnteredView(receiver) {
@@ -32443,6 +32445,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'));
@@ -32458,7 +32465,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 | « no previous file | tools/dom/src/dart2js_CustomElementSupport.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698