Chromium Code Reviews| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 } | 232 } |
| 233 | 233 |
| 234 void valueChanged(value) { | 234 void valueChanged(value) { |
| 235 if (value is! List) value = null; | 235 if (value is! List) value = null; |
| 236 | 236 |
| 237 var oldValue = iteratedValue; | 237 var oldValue = iteratedValue; |
| 238 unobserve(); | 238 unobserve(); |
| 239 iteratedValue = value; | 239 iteratedValue = value; |
| 240 | 240 |
| 241 if (iteratedValue is Observable) { | 241 if (iteratedValue is Observable) { |
| 242 _sub = iteratedValue.changes.listen(_handleChanges); | 242 _sub = (iteratedValue as Observable).changes.listen(_handleChanges); |
|
Siggi Cherem (dart-lang)
2013/07/25 16:24:12
How crazy would it be to add as a language feature
| |
| 243 } | 243 } |
| 244 | 244 |
| 245 var splices = calculateSplices( | 245 var splices = calculateSplices( |
| 246 iteratedValue != null ? iteratedValue : [], | 246 iteratedValue != null ? iteratedValue : [], |
| 247 oldValue != null ? oldValue : []); | 247 oldValue != null ? oldValue : []); |
| 248 | 248 |
| 249 if (splices.length > 0) _handleChanges(splices); | 249 if (splices.length > 0) _handleChanges(splices); |
| 250 | 250 |
| 251 if (inputs.length == 0) { | 251 if (inputs.length == 0) { |
| 252 close(); | 252 close(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 nodeExt._templateIterator = null; | 401 nodeExt._templateIterator = null; |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 | 404 |
| 405 _nodeOrCustom(node).unbindAll(); | 405 _nodeOrCustom(node).unbindAll(); |
| 406 for (var c = node.firstChild; c != null; c = c.nextNode) { | 406 for (var c = node.firstChild; c != null; c = c.nextNode) { |
| 407 _unbindAllRecursively(c); | 407 _unbindAllRecursively(c); |
| 408 } | 408 } |
| 409 } | 409 } |
| 410 } | 410 } |
| OLD | NEW |