| 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 if (!_elementPrepared) prepareElement(); | 387 if (!_elementPrepared) prepareElement(); |
| 388 | 388 |
| 389 var property = propertyForAttribute(name); | 389 var property = propertyForAttribute(name); |
| 390 if (property != null) { | 390 if (property != null) { |
| 391 unbind(name); | 391 unbind(name); |
| 392 // use n-way Polymer binding | 392 // use n-way Polymer binding |
| 393 var observer = bindProperty(property.simpleName, model, path); | 393 var observer = bindProperty(property.simpleName, model, path); |
| 394 // reflect bound property to attribute when binding | 394 // reflect bound property to attribute when binding |
| 395 // to ensure binding is not left on attribute if property | 395 // to ensure binding is not left on attribute if property |
| 396 // does not update due to not changing. | 396 // does not update due to not changing. |
| 397 reflectPropertyToAttribute(name); | 397 // Dart note: we include this patch: |
| 398 // https://github.com/Polymer/polymer/pull/319 |
| 399 reflectPropertyToAttribute(MirrorSystem.getName(property.simpleName)); |
| 398 return bindings[name] = observer; | 400 return bindings[name] = observer; |
| 399 } else { | 401 } else { |
| 400 // Cannot call super.bind because of | 402 // Cannot call super.bind because of |
| 401 // https://code.google.com/p/dart/issues/detail?id=13156 | 403 // https://code.google.com/p/dart/issues/detail?id=13156 |
| 402 // https://code.google.com/p/dart/issues/detail?id=12456 | 404 // https://code.google.com/p/dart/issues/detail?id=12456 |
| 403 return TemplateElement.mdvPackage(this).bind(name, model, path); | 405 return TemplateElement.mdvPackage(this).bind(name, model, path); |
| 404 } | 406 } |
| 405 } | 407 } |
| 406 | 408 |
| 407 void asyncUnbindAll() { | 409 void asyncUnbindAll() { |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 /** | 940 /** |
| 939 * Base class for PolymerElements deriving from HtmlElement. | 941 * Base class for PolymerElements deriving from HtmlElement. |
| 940 * | 942 * |
| 941 * See [Polymer]. | 943 * See [Polymer]. |
| 942 */ | 944 */ |
| 943 class PolymerElement extends HtmlElement with Polymer, ObservableMixin { | 945 class PolymerElement extends HtmlElement with Polymer, ObservableMixin { |
| 944 PolymerElement.created() : super.created() { | 946 PolymerElement.created() : super.created() { |
| 945 polymerCreated(); | 947 polymerCreated(); |
| 946 } | 948 } |
| 947 } | 949 } |
| OLD | NEW |