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 property as an attribute. | 7 /// Use this annotation to publish a property as an attribute. |
8 /// | 8 /// |
9 /// You can also use [PublishedProperty] to provide additional information, | 9 /// You can also use [PublishedProperty] to provide additional information, |
10 /// such as automatically syncing the property back to the attribute. | 10 /// such as automatically syncing the property back to the attribute. |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 /// Creates the document fragment to use for each instance of the custom | 636 /// Creates the document fragment to use for each instance of the custom |
637 /// element, given the `<template>` node. By default this is equivalent to: | 637 /// element, given the `<template>` node. By default this is equivalent to: |
638 /// | 638 /// |
639 /// templateBind(template).createInstance(this, polymerSyntax); | 639 /// templateBind(template).createInstance(this, polymerSyntax); |
640 /// | 640 /// |
641 /// Where polymerSyntax is a singleton [PolymerExpressions] instance. | 641 /// Where polymerSyntax is a singleton [PolymerExpressions] instance. |
642 /// | 642 /// |
643 /// You can override this method to change the instantiation behavior of the | 643 /// You can override this method to change the instantiation behavior of the |
644 /// template, for example to use a different data-binding syntax. | 644 /// template, for example to use a different data-binding syntax. |
645 DocumentFragment instanceTemplate(Element template) { | 645 DocumentFragment instanceTemplate(Element template) { |
| 646 // ensure template is decorated (lets things like <tr template ...> work) |
| 647 TemplateBindExtension.decorate(template); |
646 var syntax = this.syntax; | 648 var syntax = this.syntax; |
647 var t = templateBind(template); | 649 var t = templateBind(template); |
648 if (syntax == null && t.bindingDelegate == null) { | 650 if (syntax == null && t.bindingDelegate == null) { |
649 syntax = element.syntax; | 651 syntax = element.syntax; |
650 } | 652 } |
651 var dom = t.createInstance(this, syntax); | 653 var dom = t.createInstance(this, syntax); |
652 _observers.addAll(getTemplateInstanceBindings(dom)); | 654 _observers.addAll(getTemplateInstanceBindings(dom)); |
653 return dom; | 655 return dom; |
654 } | 656 } |
655 | 657 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 // we only care if there are registered side-effects | 838 // we only care if there are registered side-effects |
837 var callbacks = observe[name]; | 839 var callbacks = observe[name]; |
838 if (callbacks == null) return; | 840 if (callbacks == null) return; |
839 | 841 |
840 // if we are observing the previous value, stop | 842 // if we are observing the previous value, stop |
841 if (old is ObservableList) { | 843 if (old is ObservableList) { |
842 _observeLog.fine(() => '[$_name] observeArrayValue: unregister $name'); | 844 _observeLog.fine(() => '[$_name] observeArrayValue: unregister $name'); |
843 | 845 |
844 closeNamedObserver('${name}__array'); | 846 closeNamedObserver('${name}__array'); |
845 } | 847 } |
846 // if the new value is an array, being observing it | 848 // if the new value is an array, begin observing it |
847 if (value is ObservableList) { | 849 if (value is ObservableList) { |
848 _observeLog.fine(() => '[$_name] observeArrayValue: register $name'); | 850 _observeLog.fine(() => '[$_name] observeArrayValue: register $name'); |
849 var sub = value.listChanges.listen((changes) { | 851 var sub = value.listChanges.listen((changes) { |
850 for (var callback in callbacks) { | 852 for (var callback in callbacks) { |
851 smoke.invoke(this, callback, [old], adjust: true); | 853 smoke.invoke(this, callback, [changes], adjust: true); |
852 } | 854 } |
853 }); | 855 }); |
854 registerNamedObserver('${name}__array', sub); | 856 registerNamedObserver('${name}__array', sub); |
855 } | 857 } |
856 } | 858 } |
857 | 859 |
858 emitPropertyChangeRecord(Symbol name, newValue, oldValue) { | 860 emitPropertyChangeRecord(Symbol name, newValue, oldValue) { |
859 if (identical(oldValue, newValue)) return; | 861 if (identical(oldValue, newValue)) return; |
860 _propertyChange(name, newValue, oldValue); | 862 _propertyChange(name, newValue, oldValue); |
861 } | 863 } |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 final Logger _eventsLog = new Logger('polymer.events'); | 1346 final Logger _eventsLog = new Logger('polymer.events'); |
1345 final Logger _unbindLog = new Logger('polymer.unbind'); | 1347 final Logger _unbindLog = new Logger('polymer.unbind'); |
1346 final Logger _bindLog = new Logger('polymer.bind'); | 1348 final Logger _bindLog = new Logger('polymer.bind'); |
1347 final Logger _watchLog = new Logger('polymer.watch'); | 1349 final Logger _watchLog = new Logger('polymer.watch'); |
1348 final Logger _readyLog = new Logger('polymer.ready'); | 1350 final Logger _readyLog = new Logger('polymer.ready'); |
1349 | 1351 |
1350 final Expando _eventHandledTable = new Expando<Set<Node>>(); | 1352 final Expando _eventHandledTable = new Expando<Set<Node>>(); |
1351 | 1353 |
1352 final JsObject _PolymerGestures = js.context['PolymerGestures']; | 1354 final JsObject _PolymerGestures = js.context['PolymerGestures']; |
1353 | 1355 |
OLD | NEW |