| 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 $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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 138 } |
| 139 | 139 |
| 140 void clear() { | 140 void clear() { |
| 141 _this.text = ''; | 141 _this.text = ''; |
| 142 } | 142 } |
| 143 | 143 |
| 144 void operator []=(int index, Node value) { | 144 void operator []=(int index, Node value) { |
| 145 _this._replaceChild(value, this[index]); | 145 _this._replaceChild(value, this[index]); |
| 146 } | 146 } |
| 147 | 147 |
| 148 Iterator<Node> get iterator => _this.$dom_childNodes.iterator; | 148 Iterator<Node> get iterator => _this._childNodes.iterator; |
| 149 | 149 |
| 150 // From List<Node>: | 150 // From List<Node>: |
| 151 | 151 |
| 152 // TODO(jacobr): this could be implemented for child node lists. | 152 // TODO(jacobr): this could be implemented for child node lists. |
| 153 // The exception we throw here is misleading. | 153 // The exception we throw here is misleading. |
| 154 void sort([Comparator<Node> compare]) { | 154 void sort([Comparator<Node> compare]) { |
| 155 throw new UnsupportedError("Cannot sort Node list"); | 155 throw new UnsupportedError("Cannot sort Node list"); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // FIXME: implement these. | 158 // FIXME: implement these. |
| 159 void setRange(int start, int end, Iterable<Node> iterable, | 159 void setRange(int start, int end, Iterable<Node> iterable, |
| 160 [int skipCount = 0]) { | 160 [int skipCount = 0]) { |
| 161 throw new UnsupportedError("Cannot setRange on Node list"); | 161 throw new UnsupportedError("Cannot setRange on Node list"); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void fillRange(int start, int end, [Node fill]) { | 164 void fillRange(int start, int end, [Node fill]) { |
| 165 throw new UnsupportedError("Cannot fillRange on Node list"); | 165 throw new UnsupportedError("Cannot fillRange on Node list"); |
| 166 } | 166 } |
| 167 // -- end List<Node> mixins. | 167 // -- end List<Node> mixins. |
| 168 | 168 |
| 169 // TODO(jacobr): benchmark whether this is more efficient or whether caching | 169 // TODO(jacobr): benchmark whether this is more efficient or whether caching |
| 170 // a local copy of $dom_childNodes is more efficient. | 170 // a local copy of _childNodes is more efficient. |
| 171 int get length => _this.$dom_childNodes.length; | 171 int get length => _this._childNodes.length; |
| 172 | 172 |
| 173 void set length(int value) { | 173 void set length(int value) { |
| 174 throw new UnsupportedError( | 174 throw new UnsupportedError( |
| 175 "Cannot set length on immutable List."); | 175 "Cannot set length on immutable List."); |
| 176 } | 176 } |
| 177 | 177 |
| 178 Node operator[](int index) => _this.$dom_childNodes[index]; | 178 Node operator[](int index) => _this._childNodes[index]; |
| 179 } | 179 } |
| 180 | 180 |
| 181 /** Information about the instantiated template. */ | 181 /** Information about the instantiated template. */ |
| 182 class TemplateInstance { | 182 class TemplateInstance { |
| 183 // TODO(rafaelw): firstNode & lastNode should be read-synchronous | 183 // TODO(rafaelw): firstNode & lastNode should be read-synchronous |
| 184 // in cases where script has modified the template instance boundary. | 184 // in cases where script has modified the template instance boundary. |
| 185 | 185 |
| 186 /** The first node of this template instantiation. */ | 186 /** The first node of this template instantiation. */ |
| 187 final Node firstNode; | 187 final Node firstNode; |
| 188 | 188 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 Map<String, dynamic> get bindings => | 312 Map<String, dynamic> get bindings => |
| 313 TemplateElement.mdvPackage(this).bindings; | 313 TemplateElement.mdvPackage(this).bindings; |
| 314 | 314 |
| 315 /** Gets the template instance that instantiated this node, if any. */ | 315 /** Gets the template instance that instantiated this node, if any. */ |
| 316 @Experimental() | 316 @Experimental() |
| 317 TemplateInstance get templateInstance => | 317 TemplateInstance get templateInstance => |
| 318 TemplateElement.mdvPackage(this).templateInstance; | 318 TemplateElement.mdvPackage(this).templateInstance; |
| 319 | 319 |
| 320 $!MEMBERS | 320 $!MEMBERS |
| 321 } | 321 } |
| OLD | NEW |