| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 void attributeChanged(String name, String oldValue) { | 260 void attributeChanged(String name, String oldValue) { |
| 261 if (name != 'class' && name != 'style') { | 261 if (name != 'class' && name != 'style') { |
| 262 attributeToProperty(name, attributes[name]); | 262 attributeToProperty(name, attributes[name]); |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 | 265 |
| 266 // TODO(jmesserly): use stream or future here? | 266 // TODO(jmesserly): use stream or future here? |
| 267 /** |
| 268 * Run the `listener` callback *once* |
| 269 * when `node` changes, or when its children or subtree changes. |
| 270 * |
| 271 * |
| 272 * See [MutationObserver] if you want to listen to a stream of |
| 273 * changes. |
| 274 */ |
| 267 void onMutation(Node node, void listener(MutationObserver obs)) { | 275 void onMutation(Node node, void listener(MutationObserver obs)) { |
| 268 new MutationObserver((records, MutationObserver observer) { | 276 new MutationObserver((records, MutationObserver observer) { |
| 269 listener(observer); | 277 listener(observer); |
| 270 observer.disconnect(); | 278 observer.disconnect(); |
| 271 })..observe(node, childList: true, subtree: true); | 279 })..observe(node, childList: true, subtree: true); |
| 272 } | 280 } |
| 273 | 281 |
| 274 void copyInstanceAttributes() { | 282 void copyInstanceAttributes() { |
| 275 _declaration._instanceAttributes.forEach((name, value) { | 283 _declaration._instanceAttributes.forEach((name, value) { |
| 276 attributes.putIfAbsent(name, () => value); | 284 attributes.putIfAbsent(name, () => value); |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 } | 929 } |
| 922 | 930 |
| 923 final Logger _observeLog = new Logger('polymer.observe'); | 931 final Logger _observeLog = new Logger('polymer.observe'); |
| 924 final Logger _eventsLog = new Logger('polymer.events'); | 932 final Logger _eventsLog = new Logger('polymer.events'); |
| 925 final Logger _unbindLog = new Logger('polymer.unbind'); | 933 final Logger _unbindLog = new Logger('polymer.unbind'); |
| 926 final Logger _bindLog = new Logger('polymer.bind'); | 934 final Logger _bindLog = new Logger('polymer.bind'); |
| 927 | 935 |
| 928 final Expando _shadowHost = new Expando<Element>(); | 936 final Expando _shadowHost = new Expando<Element>(); |
| 929 | 937 |
| 930 final Expando _eventHandledTable = new Expando<Set<Node>>(); | 938 final Expando _eventHandledTable = new Expando<Set<Node>>(); |
| OLD | NEW |