| OLD | NEW |
| 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 /** | 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 Node get single { | 46 Node get single { |
| 47 int l = this.length; | 47 int l = this.length; |
| 48 if (l == 0) throw new StateError("No elements"); | 48 if (l == 0) throw new StateError("No elements"); |
| 49 if (l > 1) throw new StateError("More than one element"); | 49 if (l > 1) throw new StateError("More than one element"); |
| 50 return _this.$dom_firstChild; | 50 return _this.$dom_firstChild; |
| 51 } | 51 } |
| 52 $endif | 52 $endif |
| 53 | 53 |
| 54 Node min([int compare(Node a, Node b)]) { | 54 Node min([int compare(Node a, Node b)]) { |
| 55 return _Collections.minInList(this, compare); | 55 return Collections.min(this, compare); |
| 56 } | 56 } |
| 57 | 57 |
| 58 Node max([int compare(Node a, Node b)]) { | 58 Node max([int compare(Node a, Node b)]) { |
| 59 return _Collections.maxInList(this, compare); | 59 return Collections.max(this, compare); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void add(Node value) { | 62 void add(Node value) { |
| 63 _this.$dom_appendChild(value); | 63 _this.$dom_appendChild(value); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void addLast(Node value) { | 66 void addLast(Node value) { |
| 67 _this.$dom_appendChild(value); | 67 _this.$dom_appendChild(value); |
| 68 } | 68 } |
| 69 | 69 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 List mappedBy(f(Node element)) => | 118 List mappedBy(f(Node element)) => |
| 119 new MappedList<Node, dynamic>(this, f); | 119 new MappedList<Node, dynamic>(this, f); |
| 120 | 120 |
| 121 Iterable<Node> where(bool f(Node element)) => | 121 Iterable<Node> where(bool f(Node element)) => |
| 122 new WhereIterable<Node>(this, f); | 122 new WhereIterable<Node>(this, f); |
| 123 | 123 |
| 124 bool every(bool f(Node element)) => Collections.every(this, f); | 124 bool every(bool f(Node element)) => Collections.every(this, f); |
| 125 | 125 |
| 126 bool any(bool f(Node element)) => Collections.any(this, f); | 126 bool any(bool f(Node element)) => Collections.any(this, f); |
| 127 | 127 |
| 128 List<Node> toList() => new List<Node>.from(this); |
| 129 Set<Node> toSet() => new Set<Node>.from(this); |
| 130 |
| 128 bool get isEmpty => this.length == 0; | 131 bool get isEmpty => this.length == 0; |
| 129 | 132 |
| 130 // From List<Node>: | 133 // From List<Node>: |
| 131 | 134 |
| 132 List<Node> take(int n) { | 135 List<Node> take(int n) { |
| 133 return new ListView<Node>(this, 0, n); | 136 return new ListView<Node>(this, 0, n); |
| 134 } | 137 } |
| 135 | 138 |
| 136 Iterable<Node> takeWhile(bool test(Node value)) { | 139 Iterable<Node> takeWhile(bool test(Node value)) { |
| 137 return new TakeWhileIterable<Node>(this, test); | 140 return new TakeWhileIterable<Node>(this, test); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 final Node parent = this.parentNode; | 244 final Node parent = this.parentNode; |
| 242 parent.$dom_replaceChild(otherNode, this); | 245 parent.$dom_replaceChild(otherNode, this); |
| 243 } catch (e) { | 246 } catch (e) { |
| 244 | 247 |
| 245 }; | 248 }; |
| 246 return this; | 249 return this; |
| 247 } | 250 } |
| 248 | 251 |
| 249 $!MEMBERS | 252 $!MEMBERS |
| 250 } | 253 } |
| OLD | NEW |