| 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 /// Use this annotation to publish a field as an attribute. For example: | 7 /// Use this annotation to publish a field as an attribute. For example: |
| 8 /// | 8 /// |
| 9 /// class MyPlaybackElement extends PolymerElement { | 9 /// class MyPlaybackElement extends PolymerElement { |
| 10 /// // This will be available as an HTML attribute, for example: | 10 /// // This will be available as an HTML attribute, for example: |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 | 644 |
| 645 if (_bindLog.isLoggable(Level.FINE)) { | 645 if (_bindLog.isLoggable(Level.FINE)) { |
| 646 _bindLog.fine('bindProperty: [$bindable] to [${localName}].[name]'); | 646 _bindLog.fine('bindProperty: [$bindable] to [${localName}].[name]'); |
| 647 } | 647 } |
| 648 | 648 |
| 649 // capture A's value if B's value is null or undefined, | 649 // capture A's value if B's value is null or undefined, |
| 650 // otherwise use B's value | 650 // otherwise use B's value |
| 651 // TODO(sorvell): need to review, can do with ObserverTransform | 651 // TODO(sorvell): need to review, can do with ObserverTransform |
| 652 var v = bindable.value; | 652 var v = bindable.value; |
| 653 if (v == null) { | 653 if (v == null) { |
| 654 bindable.value = reflect(this).getField(name).reflectee; | 654 bindable.value = smoke.read(this, name); |
| 655 } | 655 } |
| 656 | 656 |
| 657 // TODO(jmesserly): this will create another subscription. | 657 // TODO(jmesserly): this will create another subscription. |
| 658 // It would be nice to have this reuse our existing _propertyObserver | 658 // It would be nice to have this reuse our existing _propertyObserver |
| 659 // created by observeProperties, to avoid more observation overhead. | 659 // created by observeProperties, to avoid more observation overhead. |
| 660 return new _PolymerBinding(this, name, bindable); | 660 return new _PolymerBinding(this, name, bindable); |
| 661 } | 661 } |
| 662 | 662 |
| 663 /// Attach event listeners on the host (this) element. | 663 /// Attach event listeners on the host (this) element. |
| 664 void addHostListeners() { | 664 void addHostListeners() { |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 if (_sub != null) { | 1017 if (_sub != null) { |
| 1018 if (_eventsLog.isLoggable(Level.FINE)) { | 1018 if (_eventsLog.isLoggable(Level.FINE)) { |
| 1019 _eventsLog.fine( | 1019 _eventsLog.fine( |
| 1020 'event.remove: [$_node].$_eventName => [$_model].$_path())'); | 1020 'event.remove: [$_node].$_eventName => [$_model].$_path())'); |
| 1021 } | 1021 } |
| 1022 _sub.cancel(); | 1022 _sub.cancel(); |
| 1023 _sub = null; | 1023 _sub = null; |
| 1024 } | 1024 } |
| 1025 } | 1025 } |
| 1026 } | 1026 } |
| OLD | NEW |