| 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 mdv; | 5 part of mdv; |
| 6 | 6 |
| 7 // This code is a port of Model-Driven-Views: | 7 // This code is a port of Model-Driven-Views: |
| 8 // https://github.com/polymer-project/mdv | 8 // https://github.com/polymer-project/mdv |
| 9 // The code mostly comes from src/template_element.js | 9 // The code mostly comes from src/template_element.js |
| 10 | 10 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 final Element _templateElement; | 239 final Element _templateElement; |
| 240 final List<Node> terminators = []; | 240 final List<Node> terminators = []; |
| 241 final CompoundBinding inputs; | 241 final CompoundBinding inputs; |
| 242 List iteratedValue; | 242 List iteratedValue; |
| 243 Object _lastValue; | 243 Object _lastValue; |
| 244 | 244 |
| 245 StreamSubscription _sub; | 245 StreamSubscription _sub; |
| 246 StreamSubscription _valueBinding; | 246 StreamSubscription _valueBinding; |
| 247 | 247 |
| 248 _TemplateIterator(this._templateElement) | 248 _TemplateIterator(this._templateElement) |
| 249 : inputs = new CompoundBinding(resolveInputs) { | 249 : inputs = new CompoundBinding(resolveInputs) { |
| 250 | 250 |
| 251 _valueBinding = new PathObserver(inputs, 'value').bindSync(valueChanged); | 251 _valueBinding = new PathObserver(inputs, 'value').bindSync(valueChanged); |
| 252 } | 252 } |
| 253 | 253 |
| 254 static Object resolveInputs(Map values) { | 254 static Object resolveInputs(Map values) { |
| 255 if (values.containsKey('if') && !_toBoolean(values['if'])) { | 255 if (values.containsKey('if') && !_toBoolean(values['if'])) { |
| 256 return null; | 256 return null; |
| 257 } | 257 } |
| 258 | 258 |
| 259 if (values.containsKey('repeat')) { | 259 if (values.containsKey('repeat')) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 nodeExt._templateIterator = null; | 421 nodeExt._templateIterator = null; |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 | 424 |
| 425 _nodeOrCustom(node).unbindAll(); | 425 _nodeOrCustom(node).unbindAll(); |
| 426 for (var c = node.firstChild; c != null; c = c.nextNode) { | 426 for (var c = node.firstChild; c != null; c = c.nextNode) { |
| 427 _unbindAllRecursively(c); | 427 _unbindAllRecursively(c); |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 } | 430 } |
| OLD | NEW |