| 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 template_binding; | 5 part of template_binding; |
| 6 | 6 |
| 7 class _InstanceBindingMap { | 7 class _InstanceBindingMap { |
| 8 final List bindings; | 8 final List bindings; |
| 9 List<_InstanceBindingMap> children; | 9 List<_InstanceBindingMap> children; |
| 10 DocumentFragment content; | 10 DocumentFragment content; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (bindings.isTemplate) { | 64 if (bindings.isTemplate) { |
| 65 TemplateBindExtension.decorate(clone, node); | 65 TemplateBindExtension.decorate(clone, node); |
| 66 if (delegate != null) { | 66 if (delegate != null) { |
| 67 templateBindFallback(clone).bindingDelegate = delegate; | 67 templateBindFallback(clone).bindingDelegate = delegate; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 _processBindings(clone, bindings, model, instanceBindings); | 71 _processBindings(clone, bindings, model, instanceBindings); |
| 72 return clone; | 72 return clone; |
| 73 } | 73 } |
| 74 |
| 75 // TODO(rafaelw): Setup a MutationObserver on content which clears the expando |
| 76 // so that bindingMaps regenerate when template.content changes. |
| 77 _getInstanceBindingMap(DocumentFragment content, BindingDelegate delegate) { |
| 78 if (delegate == null) delegate = BindingDelegate._DEFAULT; |
| 79 |
| 80 if (delegate._bindingMaps == null) delegate._bindingMaps = new Expando(); |
| 81 var map = delegate._bindingMaps[content]; |
| 82 if (map == null) { |
| 83 map = _createInstanceBindingMap(content, delegate); |
| 84 delegate._bindingMaps[content] = map; |
| 85 } |
| 86 return map; |
| 87 } |
| OLD | NEW |