| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class FilteredElementList implements ElementList { | 5 class FilteredElementList implements ElementList { |
| 6 final Node _node; | 6 final Node _node; |
| 7 final NodeList _childNodes; | 7 final NodeList _childNodes; |
| 8 | 8 |
| 9 FilteredElementList(Node node): _childNodes = node.nodes, _node = node; | 9 FilteredElementList(Node node): _childNodes = node.nodes, _node = node; |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 void operator []=(int index, Element value) { | 32 void operator []=(int index, Element value) { |
| 33 this[index].replaceWith(value); | 33 this[index].replaceWith(value); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void set length(int newLength) { | 36 void set length(int newLength) { |
| 37 final len = this.length; | 37 final len = this.length; |
| 38 if (newLength >= len) { | 38 if (newLength >= len) { |
| 39 return; | 39 return; |
| 40 } else if (newLength < 0) { | 40 } else if (newLength < 0) { |
| 41 throw const IllegalArgumentException("Invalid list length"); | 41 throw const ArgumentError("Invalid list length"); |
| 42 } | 42 } |
| 43 | 43 |
| 44 removeRange(newLength - 1, len - newLength); | 44 removeRange(newLength - 1, len - newLength); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void add(Element value) { | 47 void add(Element value) { |
| 48 _childNodes.add(value); | 48 _childNodes.add(value); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void addAll(Collection<Element> collection) { | 51 void addAll(Collection<Element> collection) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 switch (where.toLowerCase()) { | 183 switch (where.toLowerCase()) { |
| 184 case "beforebegin": return null; | 184 case "beforebegin": return null; |
| 185 case "afterend": return null; | 185 case "afterend": return null; |
| 186 case "afterbegin": | 186 case "afterbegin": |
| 187 this.insertBefore(node, this.nodes.first); | 187 this.insertBefore(node, this.nodes.first); |
| 188 return node; | 188 return node; |
| 189 case "beforeend": | 189 case "beforeend": |
| 190 this.nodes.add(node); | 190 this.nodes.add(node); |
| 191 return node; | 191 return node; |
| 192 default: | 192 default: |
| 193 throw new IllegalArgumentException("Invalid position ${where}"); | 193 throw new ArgumentError("Invalid position ${where}"); |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 Element insertAdjacentElement(String where, Element element) | 197 Element insertAdjacentElement(String where, Element element) |
| 198 => this._insertAdjacentNode(where, element); | 198 => this._insertAdjacentNode(where, element); |
| 199 | 199 |
| 200 void insertAdjacentText(String where, String text) { | 200 void insertAdjacentText(String where, String text) { |
| 201 this._insertAdjacentNode(where, new Text(text)); | 201 this._insertAdjacentNode(where, new Text(text)); |
| 202 } | 202 } |
| 203 | 203 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 "WebKit drop zone can't be set for document fragments."); | 352 "WebKit drop zone can't be set for document fragments."); |
| 353 } | 353 } |
| 354 | 354 |
| 355 void set webkitRegionOverflow(String value) { | 355 void set webkitRegionOverflow(String value) { |
| 356 throw new UnsupportedOperationException( | 356 throw new UnsupportedOperationException( |
| 357 "WebKit region overflow can't be set for document fragments."); | 357 "WebKit region overflow can't be set for document fragments."); |
| 358 } | 358 } |
| 359 | 359 |
| 360 $!MEMBERS | 360 $!MEMBERS |
| 361 } | 361 } |
| OLD | NEW |