| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 return fragment; | 186 return fragment; |
| 187 } | 187 } |
| 188 | 188 |
| 189 ElementList get elements() { | 189 ElementList get elements() { |
| 190 if (_elements == null) { | 190 if (_elements == null) { |
| 191 _elements = new FilteredElementList(this); | 191 _elements = new FilteredElementList(this); |
| 192 } | 192 } |
| 193 return _elements; | 193 return _elements; |
| 194 } | 194 } |
| 195 | 195 |
| 196 // TODO: The type of value should be Collection<Element>. See http://b/5392897 | 196 void set elements(Collection<Element> value) { |
| 197 void set elements(value) { | |
| 198 // Copy list first since we don't want liveness during iteration. | 197 // Copy list first since we don't want liveness during iteration. |
| 199 List copy = new List.from(value); | 198 List copy = new List.from(value); |
| 200 final elements = this.elements; | 199 final elements = this.elements; |
| 201 elements.clear(); | 200 elements.clear(); |
| 202 elements.addAll(copy); | 201 elements.addAll(copy); |
| 203 } | 202 } |
| 204 | 203 |
| 205 String get innerHTML() { | 204 String get innerHTML() { |
| 206 var e = new Element.tag("div"); | 205 var e = new Element.tag("div"); |
| 207 e.nodes.add(this.clone(true)); | 206 e.nodes.add(this.clone(true)); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 "Title can't be set for document fragments."); | 388 "Title can't be set for document fragments."); |
| 390 } | 389 } |
| 391 | 390 |
| 392 void set webkitdropzone(String value) { | 391 void set webkitdropzone(String value) { |
| 393 throw new UnsupportedOperationException( | 392 throw new UnsupportedOperationException( |
| 394 "WebKit drop zone can't be set for document fragments."); | 393 "WebKit drop zone can't be set for document fragments."); |
| 395 } | 394 } |
| 396 | 395 |
| 397 DocumentFragment clone(bool deep) => super.clone(deep); | 396 DocumentFragment clone(bool deep) => super.clone(deep); |
| 398 } | 397 } |
| OLD | NEW |