| 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 html; | 5 part of html; |
| 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 static void _removeAllBindingsRecursively(Node node) { | 604 static void _removeAllBindingsRecursively(Node node) { |
| 605 _nodeOrCustom(node).unbindAll(); | 605 _nodeOrCustom(node).unbindAll(); |
| 606 for (var c = node.$dom_firstChild; c != null; c = c.nextNode) { | 606 for (var c = node.$dom_firstChild; c != null; c = c.nextNode) { |
| 607 _removeAllBindingsRecursively(c); | 607 _removeAllBindingsRecursively(c); |
| 608 } | 608 } |
| 609 } | 609 } |
| 610 | 610 |
| 611 static void _removeChild(Node parent, Node child) { | 611 static void _removeChild(Node parent, Node child) { |
| 612 child._templateInstance = null; | 612 child._templateInstance = null; |
| 613 if (child is Element && (child as Element).isTemplate) { | 613 if (child is Element && (child as Element).isTemplate) { |
| 614 Element childElement = child; |
| 614 // Make sure we stop observing when we remove an element. | 615 // Make sure we stop observing when we remove an element. |
| 615 var templateIterator = child._templateIterator; | 616 var templateIterator = childElement._templateIterator; |
| 616 if (templateIterator != null) { | 617 if (templateIterator != null) { |
| 617 templateIterator.abandon(); | 618 templateIterator.abandon(); |
| 618 child._templateIterator = null; | 619 childElement._templateIterator = null; |
| 619 } | 620 } |
| 620 } | 621 } |
| 621 child.remove(); | 622 child.remove(); |
| 622 _removeAllBindingsRecursively(child); | 623 _removeAllBindingsRecursively(child); |
| 623 } | 624 } |
| 624 } | 625 } |
| 625 | 626 |
| 626 class _BindingToken { | 627 class _BindingToken { |
| 627 final String value; | 628 final String value; |
| 628 final bool isBinding; | 629 final bool isBinding; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 _sub.cancel(); | 780 _sub.cancel(); |
| 780 _sub = null; | 781 _sub = null; |
| 781 } | 782 } |
| 782 | 783 |
| 783 void abandon() { | 784 void abandon() { |
| 784 unobserve(); | 785 unobserve(); |
| 785 _valueBinding.cancel(); | 786 _valueBinding.cancel(); |
| 786 inputs.dispose(); | 787 inputs.dispose(); |
| 787 } | 788 } |
| 788 } | 789 } |
| OLD | NEW |