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

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

Issue 25325004: Implementing CustomElement's attributeChanged callback. (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') | tools/dom/templates/html/impl/impl_Element.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 c708105d93c4ce476b12b59fed3cb4e860919ef0..a3fa0bf1360ec05df789d057c278c12991f59646 100644
--- a/tools/dom/src/dart2js_CustomElementSupport.dart
+++ b/tools/dom/src/dart2js_CustomElementSupport.dart
@@ -15,6 +15,9 @@ _callEnteredView(receiver) {
_callLeftView(receiver) {
return receiver.leftView();
}
+ _callAttributeChanged(receiver, name, oldValue, newValue) {
+ return receiver.attributeChanged(name, oldValue, newValue);
+}
_makeCallbackMethod(callback) {
return JS('',
@@ -26,6 +29,16 @@ _makeCallbackMethod(callback) {
convertDartClosureToJS(callback, 1));
}
+_makeCallbackMethod3(callback) {
+ return JS('',
+ '''((function(invokeCallback) {
+ return function(arg1, arg2, arg3) {
+ return invokeCallback(this, arg1, arg2, arg3);
+ };
+ })(#))''',
+ convertDartClosureToJS(callback, 4));
+}
+
const _typeNameToTag = const {
'HTMLAnchorElement': 'a',
'HTMLAudioElement': 'audio',
@@ -91,6 +104,8 @@ void _registerCustomElement(context, document, String tag, Type type,
JS('=Object', '{value: #}', _makeCallbackMethod(_callEnteredView)));
JS('void', '#.leftViewCallback = #', properties,
JS('=Object', '{value: #}', _makeCallbackMethod(_callLeftView)));
+ JS('void', '#.attributeChangedCallback = #', properties,
+ JS('=Object', '{value: #}', _makeCallbackMethod3(_callAttributeChanged)));
// TODO(blois): Bug 13220- remove once transition is complete
JS('void', '#.enteredDocumentCallback = #', properties,
« no previous file with comments | « tests/html/html.status ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698