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

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 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:
Download patch
« no previous file with comments | « sdk/lib/_internal/lib/js_helper.dart ('k') | sdk/lib/html/dartium/html_dartium.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 7bbd1a677bb74281a0031f9b8fe70639d70bd717..6c9cfd93199278fe2286c1d9e5b1bc7d7ed3385a 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -9287,6 +9287,11 @@ abstract class Element extends Node implements ParentNode, ChildNode native "Ele
@Experimental()
void leftView() {}
+ /**
+ * Called by the DOM whenever an attribute on this has been changed.
+ */
+ void attributeChanged(String name, String oldValue, String newValue) {}
+
// Hooks to support custom WebComponents.
@Creates('Null') // Set from Dart code; does not instantiate a native type.
@@ -32543,6 +32548,9 @@ _callEnteredView(receiver) {
_callLeftView(receiver) {
return receiver.leftView();
}
+ _callAttributeChanged(receiver, name, oldValue, newValue) {
+ return receiver.attributeChanged(name, oldValue, newValue);
+}
_makeCallbackMethod(callback) {
return JS('',
@@ -32554,6 +32562,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',
@@ -32619,6 +32637,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 | « sdk/lib/_internal/lib/js_helper.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698