Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Side by Side Diff: pkg/mdv/lib/src/template_iterator.dart

Issue 19996008: automatically clean up CompoundBinding (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/observe/lib/src/compound_binding.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 void unobserve() { 378 void unobserve() {
379 if (_sub == null) return; 379 if (_sub == null) return;
380 _sub.cancel(); 380 _sub.cancel();
381 _sub = null; 381 _sub = null;
382 } 382 }
383 383
384 void close() { 384 void close() {
385 if (closed) return; 385 if (closed) return;
386 386
387 unobserve(); 387 unobserve();
388 inputs.close();
388 terminators.clear(); 389 terminators.clear();
389 inputs.dispose();
390 closed = true; 390 closed = true;
391 } 391 }
392 392
393 static void _unbindAllRecursively(Node node) { 393 static void _unbindAllRecursively(Node node) {
394 var nodeExt = _mdv(node); 394 var nodeExt = _mdv(node);
395 nodeExt._templateInstance = null; 395 nodeExt._templateInstance = null;
396 if (node is Element && (node as Element).isTemplate) { 396 if (node is Element && (node as Element).isTemplate) {
397 // Make sure we stop observing when we remove an element. 397 // Make sure we stop observing when we remove an element.
398 var templateIterator = nodeExt._templateIterator; 398 var templateIterator = nodeExt._templateIterator;
399 if (templateIterator != null) { 399 if (templateIterator != null) {
400 templateIterator.close(); 400 templateIterator.close();
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/observe/lib/src/compound_binding.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698