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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // TODO(jmesserly): use stream or future here? | 266 // TODO(jmesserly): use stream or future here? |
267 void onMutation(Node node, void listener(MutationObserver obs)) { | 267 void onMutation(Node node, void listener(MutationObserver obs)) { |
268 new MutationObserver((records, MutationObserver observer) { | 268 new MutationObserver((records, MutationObserver observer) { |
269 listener(observer); | 269 listener(observer); |
270 observer.disconnect(); | 270 observer.disconnect(); |
271 })..observe(node, childList: true, subtree: true); | 271 })..observe(node, childList: true, subtree: true); |
272 } | 272 } |
273 | 273 |
274 void copyInstanceAttributes() { | 274 void copyInstanceAttributes() { |
275 _declaration._instanceAttributes.forEach((name, value) { | 275 _declaration._instanceAttributes.forEach((name, value) { |
276 attributes[name] = value; | 276 attributes.putIfAbsent(name, () => value); |
277 }); | 277 }); |
278 } | 278 } |
279 | 279 |
280 void takeAttributes() { | 280 void takeAttributes() { |
281 if (_declaration._publishLC == null) return; | 281 if (_declaration._publishLC == null) return; |
282 attributes.forEach(attributeToProperty); | 282 attributes.forEach(attributeToProperty); |
283 } | 283 } |
284 | 284 |
285 /** | 285 /** |
286 * If attribute [name] is mapped to a property, deserialize | 286 * If attribute [name] is mapped to a property, deserialize |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 } | 921 } |
922 | 922 |
923 final Logger _observeLog = new Logger('polymer.observe'); | 923 final Logger _observeLog = new Logger('polymer.observe'); |
924 final Logger _eventsLog = new Logger('polymer.events'); | 924 final Logger _eventsLog = new Logger('polymer.events'); |
925 final Logger _unbindLog = new Logger('polymer.unbind'); | 925 final Logger _unbindLog = new Logger('polymer.unbind'); |
926 final Logger _bindLog = new Logger('polymer.bind'); | 926 final Logger _bindLog = new Logger('polymer.bind'); |
927 | 927 |
928 final Expando _shadowHost = new Expando<Element>(); | 928 final Expando _shadowHost = new Expando<Element>(); |
929 | 929 |
930 final Expando _eventHandledTable = new Expando<Set<Node>>(); | 930 final Expando _eventHandledTable = new Expando<Set<Node>>(); |
OLD | NEW |