| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of polymer; | 5 part of polymer; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Use this annotation to publish a field as an attribute. For example: | 8 * Use this annotation to publish a field as an attribute. For example: |
| 9 * | 9 * |
| 10 * class MyPlaybackElement extends PolymerElement { | 10 * class MyPlaybackElement extends PolymerElement { |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 static getBindingWithEvents( | 741 static getBindingWithEvents( |
| 742 model, String path, name, node, originalGetBinding) { | 742 model, String path, name, node, originalGetBinding) { |
| 743 // if lhs an event prefix, | 743 // if lhs an event prefix, |
| 744 if (name is! String || !_hasEventPrefix(name)) { | 744 if (name is! String || !_hasEventPrefix(name)) { |
| 745 return originalGetBinding(model, path, name, node); | 745 return originalGetBinding(model, path, name, node); |
| 746 } | 746 } |
| 747 | 747 |
| 748 // provide an event-binding callback. | 748 // provide an event-binding callback. |
| 749 // return (model, name, node) { | 749 // return (model, name, node) { |
| 750 if (_eventsLog.isLoggable(Level.FINE)) { | 750 if (_eventsLog.isLoggable(Level.FINE)) { |
| 751 _eventsLog.fine('event: [${node.localName}].$name => ' | 751 _eventsLog.fine('event: [$node].$name => [$model].$path())'); |
| 752 '[${model.localName}].$path())'); | |
| 753 } | 752 } |
| 754 var eventName = _removeEventPrefix(name); | 753 var eventName = _removeEventPrefix(name); |
| 755 // TODO(sigmund): polymer.js dropped event translations. reconcile? | 754 // TODO(sigmund): polymer.js dropped event translations. reconcile? |
| 756 var translated = _eventTranslations[eventName]; | 755 var translated = _eventTranslations[eventName]; |
| 757 eventName = translated != null ? translated : eventName; | 756 eventName = translated != null ? translated : eventName; |
| 758 return node.on[eventName].listen((event) { | 757 return node.on[eventName].listen((event) { |
| 759 var ctrlr = _findController(node); | 758 var ctrlr = _findController(node); |
| 760 if (ctrlr is! Polymer) return; | 759 if (ctrlr is! Polymer) return; |
| 761 var obj = ctrlr; | 760 var obj = ctrlr; |
| 762 var method = path; | 761 var method = path; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 Object oldValue, newValue; | 1071 Object oldValue, newValue; |
| 1073 _PropertyValue(this.oldValue); | 1072 _PropertyValue(this.oldValue); |
| 1074 } | 1073 } |
| 1075 | 1074 |
| 1076 class _PolymerExpressionsWithEventDelegate extends PolymerExpressions { | 1075 class _PolymerExpressionsWithEventDelegate extends PolymerExpressions { |
| 1077 getBinding(model, String path, name, node) { | 1076 getBinding(model, String path, name, node) { |
| 1078 return Polymer.getBindingWithEvents( | 1077 return Polymer.getBindingWithEvents( |
| 1079 model, path, name, node, super.getBinding); | 1078 model, path, name, node, super.getBinding); |
| 1080 } | 1079 } |
| 1081 } | 1080 } |
| OLD | NEW |