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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 } | 83 } |
84 | 84 |
85 Node removeAt(int index) { | 85 Node removeAt(int index) { |
86 var result = this[index]; | 86 var result = this[index]; |
87 if (result != null) { | 87 if (result != null) { |
88 _this.$dom_removeChild(result); | 88 _this.$dom_removeChild(result); |
89 } | 89 } |
90 return result; | 90 return result; |
91 } | 91 } |
92 | 92 |
93 void remove(Object object) { | |
floitsch
2013/01/17 13:36:58
Why doesn't this class need the other methods? Is
Lasse Reichstein Nielsen
2013/01/18 11:41:48
Good question. I can't remember why I didn't add t
| |
94 if (object is! Node) return; | |
95 Node node = object; | |
96 if (!identical(this, node.parentNode)) return; | |
97 _this.$dom_removeChild(node); | |
98 } | |
99 | |
100 | |
93 void clear() { | 101 void clear() { |
94 _this.text = ''; | 102 _this.text = ''; |
95 } | 103 } |
96 | 104 |
97 void operator []=(int index, Node value) { | 105 void operator []=(int index, Node value) { |
98 _this.$dom_replaceChild(value, this[index]); | 106 _this.$dom_replaceChild(value, this[index]); |
99 } | 107 } |
100 | 108 |
101 Iterator<Node> get iterator => _this.$dom_childNodes.iterator; | 109 Iterator<Node> get iterator => _this.$dom_childNodes.iterator; |
102 | 110 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 final Node parent = this.parentNode; | 252 final Node parent = this.parentNode; |
245 parent.$dom_replaceChild(otherNode, this); | 253 parent.$dom_replaceChild(otherNode, this); |
246 } catch (e) { | 254 } catch (e) { |
247 | 255 |
248 }; | 256 }; |
249 return this; | 257 return this; |
250 } | 258 } |
251 | 259 |
252 $!MEMBERS | 260 $!MEMBERS |
253 } | 261 } |
OLD | NEW |