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

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

Issue 11794031: Fixing FrozenElementList Iterator (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | no next file » | 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) 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 html; 5 part of html;
6 6
7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated 7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated
8 // functionality. 8 // functionality.
9 class _ChildrenElementList implements List { 9 class _ChildrenElementList implements List {
10 // Raw Element. 10 // Raw Element.
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 return _Collections.minInList(this, compare); 381 return _Collections.minInList(this, compare);
382 } 382 }
383 383
384 Element max([int compare(Element a, Element b)]) { 384 Element max([int compare(Element a, Element b)]) {
385 return _Collections.maxInList(this, compare); 385 return _Collections.maxInList(this, compare);
386 } 386 }
387 } 387 }
388 388
389 class _FrozenElementListIterator implements Iterator<Element> { 389 class _FrozenElementListIterator implements Iterator<Element> {
390 final _FrozenElementList _list; 390 final _FrozenElementList _list;
391 int _index = 0; 391 int _index = -1;
392 Element _current; 392 Element _current;
393 393
394 _FrozenElementListIterator(this._list); 394 _FrozenElementListIterator(this._list);
395 395
396 /** 396 /**
397 * Moves to the next element. Returns true if the iterator is positioned 397 * Moves to the next element. Returns true if the iterator is positioned
398 * at an element. Returns false if it is positioned after the last element. 398 * at an element. Returns false if it is positioned after the last element.
399 */ 399 */
400 bool moveNext() { 400 bool moveNext() {
401 int nextIndex = _index + 1; 401 int nextIndex = _index + 1;
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 $if DART2JS 881 $if DART2JS
882 // Optimization to improve performance until the dart2js compiler inlines this 882 // Optimization to improve performance until the dart2js compiler inlines this
883 // method. 883 // method.
884 static dynamic createElement_tag(String tag) => 884 static dynamic createElement_tag(String tag) =>
885 JS('Element', 'document.createElement(#)', tag); 885 JS('Element', 'document.createElement(#)', tag);
886 $else 886 $else
887 static Element createElement_tag(String tag) => 887 static Element createElement_tag(String tag) =>
888 document.$dom_createElement(tag); 888 document.$dom_createElement(tag);
889 $endif 889 $endif
890 } 890 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698