| 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 /** | 5 /** |
| 6 * Lazy implementation of the child nodes of an element that does not request | 6 * Lazy implementation of the child nodes of an element that does not request |
| 7 * the actual child nodes of an element until strictly necessary greatly | 7 * the actual child nodes of an element until strictly necessary greatly |
| 8 * improving performance for the typical cases where it is not required. | 8 * improving performance for the typical cases where it is not required. |
| 9 */ | 9 */ |
| 10 class _ChildNodeListLazy implements List { | 10 class _ChildNodeListLazy implements List { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 void operator []=(int index, _NodeImpl value) { | 51 void operator []=(int index, _NodeImpl value) { |
| 52 _this.$dom_replaceChild(value, this[index]); | 52 _this.$dom_replaceChild(value, this[index]); |
| 53 } | 53 } |
| 54 | 54 |
| 55 Iterator<Node> iterator() => _this.$dom_childNodes.iterator(); | 55 Iterator<Node> iterator() => _this.$dom_childNodes.iterator(); |
| 56 | 56 |
| 57 // TODO(jacobr): We can implement these methods much more efficiently by | 57 // TODO(jacobr): We can implement these methods much more efficiently by |
| 58 // looking up the nodeList only once instead of once per iteration. | 58 // looking up the nodeList only once instead of once per iteration. |
| 59 bool contains(Node element) => _Collections.contains(this, element); |
| 60 |
| 59 void forEach(void f(Node element)) => _Collections.forEach(this, f); | 61 void forEach(void f(Node element)) => _Collections.forEach(this, f); |
| 60 | 62 |
| 61 Collection map(f(Node element)) => _Collections.map(this, [], f); | 63 Collection map(f(Node element)) => _Collections.map(this, [], f); |
| 62 | 64 |
| 63 Collection<Node> filter(bool f(Node element)) => | 65 Collection<Node> filter(bool f(Node element)) => |
| 64 new _NodeListWrapper(_Collections.filter(this, <Node>[], f)); | 66 new _NodeListWrapper(_Collections.filter(this, <Node>[], f)); |
| 65 | 67 |
| 66 bool every(bool f(Node element)) => _Collections.every(this, f); | 68 bool every(bool f(Node element)) => _Collections.every(this, f); |
| 67 | 69 |
| 68 bool some(bool f(Node element)) => _Collections.some(this, f); | 70 bool some(bool f(Node element)) => _Collections.some(this, f); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 final _NodeImpl parent = this.parent; | 139 final _NodeImpl parent = this.parent; |
| 138 parent.$dom_replaceChild(otherNode, this); | 140 parent.$dom_replaceChild(otherNode, this); |
| 139 } catch (e) { | 141 } catch (e) { |
| 140 | 142 |
| 141 }; | 143 }; |
| 142 return this; | 144 return this; |
| 143 } | 145 } |
| 144 | 146 |
| 145 $!MEMBERS | 147 $!MEMBERS |
| 146 } | 148 } |
| OLD | NEW |