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

Side by Side Diff: tools/dom/templates/html/impl/impl_Node.darttemplate

Issue 13704017: Make html lists print a nice toString method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 /** 7 /**
8 * Lazy implementation of the child nodes of an element that does not request 8 * Lazy implementation of the child nodes of an element that does not request
9 * the actual child nodes of an element until strictly necessary greatly 9 * the actual child nodes of an element until strictly necessary greatly
10 * improving performance for the typical cases where it is not required. 10 * improving performance for the typical cases where it is not required.
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 "Cannot insertRange on immutable List."); 245 "Cannot insertRange on immutable List.");
246 } 246 }
247 List<Node> sublist(int start, [int end]) { 247 List<Node> sublist(int start, [int end]) {
248 if (end == null) end == length; 248 if (end == null) end == length;
249 return Lists.getRange(this, start, end, <Node>[]); 249 return Lists.getRange(this, start, end, <Node>[]);
250 } 250 }
251 251
252 List<Node> getRange(int start, int rangeLength) => 252 List<Node> getRange(int start, int rangeLength) =>
253 sublist(start, start + rangeLength); 253 sublist(start, start + rangeLength);
254 254
255 String toString() {
256 StringBuffer buffer = new StringBuffer('[');
257 buffer.writeAll(this, ', ');
258 buffer.write(']');
259 return buffer.toString();
260 }
255 // -- end List<Node> mixins. 261 // -- end List<Node> mixins.
256 262
257 // TODO(jacobr): benchmark whether this is more efficient or whether caching 263 // TODO(jacobr): benchmark whether this is more efficient or whether caching
258 // a local copy of $dom_childNodes is more efficient. 264 // a local copy of $dom_childNodes is more efficient.
259 int get length => _this.$dom_childNodes.length; 265 int get length => _this.$dom_childNodes.length;
260 266
261 void set length(int value) { 267 void set length(int value) {
262 throw new UnsupportedError( 268 throw new UnsupportedError(
263 "Cannot set length on immutable List."); 269 "Cannot set length on immutable List.");
264 } 270 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 if (_modelChangedStream == null) { 419 if (_modelChangedStream == null) {
414 // Ensure the model is cached locally to minimize change notifications. 420 // Ensure the model is cached locally to minimize change notifications.
415 _model = model; 421 _model = model;
416 _modelChangedStream = new StreamController.broadcast(); 422 _modelChangedStream = new StreamController.broadcast();
417 } 423 }
418 return _modelChangedStream.stream; 424 return _modelChangedStream.stream;
419 } 425 }
420 426
421 $!MEMBERS 427 $!MEMBERS
422 } 428 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_Element.darttemplate ('k') | tools/dom/templates/immutable_list_mixin.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698