| 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 /** | 738 /** |
| 739 * Bind events via attributes of the form `on-eventName`. This method can be | 739 * Bind events via attributes of the form `on-eventName`. This method can be |
| 740 * use to hooks into the model syntax and adds event listeners as needed. By | 740 * use to hooks into the model syntax and adds event listeners as needed. By |
| 741 * default, binding paths are always method names on the root model, the | 741 * default, binding paths are always method names on the root model, the |
| 742 * custom element in which the node exists. Adding a '@' in the path directs | 742 * custom element in which the node exists. Adding a '@' in the path directs |
| 743 * the event binding to use the model path as the event listener. In both | 743 * the event binding to use the model path as the event listener. In both |
| 744 * cases, the actual listener is attached to a generic method which evaluates | 744 * cases, the actual listener is attached to a generic method which evaluates |
| 745 * the bound path at event execution time. | 745 * the bound path at event execution time. |
| 746 */ | 746 */ |
| 747 // from src/instance/event.js#prepareBinding | 747 // from src/instance/event.js#prepareBinding |
| 748 // Dart note: template_binding doesn't have the notion of prepareBinding, so | |
| 749 // we implement this by wrapping/overriding getBinding instead. | |
| 750 // TODO(sorvell): we're patching the syntax while evaluating | 748 // TODO(sorvell): we're patching the syntax while evaluating |
| 751 // event bindings. we'll move this to a better spot when that's done | 749 // event bindings. we'll move this to a better spot when that's done |
| 752 static PrepareBindingFunction prepareBinding(String path, String name, node, | 750 static PrepareBindingFunction prepareBinding(String path, String name, node, |
| 753 originalPrepareBinding) { | 751 originalPrepareBinding) { |
| 754 | 752 |
| 755 // if lhs an event prefix, | 753 // if lhs an event prefix, |
| 756 if (!_hasEventPrefix(name)) return originalPrepareBinding(path, name, node); | 754 if (!_hasEventPrefix(name)) return originalPrepareBinding(path, name, node); |
| 757 | 755 |
| 758 // provide an event-binding callback. | 756 // provide an event-binding callback. |
| 759 return (model, node) { | 757 return (model, node) { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 | 1088 |
| 1091 class _PropertyValue { | 1089 class _PropertyValue { |
| 1092 Object oldValue, newValue; | 1090 Object oldValue, newValue; |
| 1093 _PropertyValue(this.oldValue); | 1091 _PropertyValue(this.oldValue); |
| 1094 } | 1092 } |
| 1095 | 1093 |
| 1096 class _PolymerExpressionsWithEventDelegate extends PolymerExpressions { | 1094 class _PolymerExpressionsWithEventDelegate extends PolymerExpressions { |
| 1097 prepareBinding(String path, name, node) => | 1095 prepareBinding(String path, name, node) => |
| 1098 Polymer.prepareBinding(path, name, node, super.prepareBinding); | 1096 Polymer.prepareBinding(path, name, node, super.prepareBinding); |
| 1099 } | 1097 } |
| OLD | NEW |