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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 329 } |
330 | 330 |
331 void _handleChanges(Iterable<ChangeRecord> splices) { | 331 void _handleChanges(Iterable<ChangeRecord> splices) { |
332 if (closed) return; | 332 if (closed) return; |
333 | 333 |
334 splices = splices.where((s) => s is ListChangeRecord); | 334 splices = splices.where((s) => s is ListChangeRecord); |
335 | 335 |
336 var template = _templateElement; | 336 var template = _templateElement; |
337 var delegate = template.bindingDelegate; | 337 var delegate = template.bindingDelegate; |
338 | 338 |
339 if (template.parentNode == null || template.document.window == null) { | 339 if (template.parentNode == null || template.ownerDocument.window == null) { |
340 close(); | 340 close(); |
341 // TODO(jmesserly): MDV calls templateIteratorTable.delete(this) here, | 341 // TODO(jmesserly): MDV calls templateIteratorTable.delete(this) here, |
342 // but I think that's a no-op because only nodes are used as keys. | 342 // but I think that's a no-op because only nodes are used as keys. |
343 // See https://github.com/Polymer/mdv/pull/114. | 343 // See https://github.com/Polymer/mdv/pull/114. |
344 return; | 344 return; |
345 } | 345 } |
346 | 346 |
347 var instanceCache = new HashMap(equals: identical); | 347 var instanceCache = new HashMap(equals: identical); |
348 var removeDelta = 0; | 348 var removeDelta = 0; |
349 for (var splice in splices) { | 349 for (var splice in splices) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 nodeExt._templateIterator = null; | 405 nodeExt._templateIterator = null; |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 _nodeOrCustom(node).unbindAll(); | 409 _nodeOrCustom(node).unbindAll(); |
410 for (var c = node.firstChild; c != null; c = c.nextNode) { | 410 for (var c = node.firstChild; c != null; c = c.nextNode) { |
411 _unbindAllRecursively(c); | 411 _unbindAllRecursively(c); |
412 } | 412 } |
413 } | 413 } |
414 } | 414 } |
OLD | NEW |