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 class _XMLClassSet extends _CssClassSet { | 5 class _XMLClassSet extends _CssClassSet { |
6 _XMLClassSet(element) : super(element); | 6 _XMLClassSet(element) : super(element); |
7 | 7 |
8 String _className() { | 8 String _className() { |
9 final classStr = _element.getAttribute('class'); | 9 final classStr = _element.getAttribute('class'); |
10 return classStr == null ? '' : classStr; | 10 return classStr == null ? '' : classStr; |
(...skipping 25 matching lines...) Expand all Loading... |
36 return _cssClassSet; | 36 return _cssClassSet; |
37 } | 37 } |
38 | 38 |
39 ElementList get elements() { | 39 ElementList get elements() { |
40 if (_elements == null) { | 40 if (_elements == null) { |
41 _elements = new FilteredElementList(this); | 41 _elements = new FilteredElementList(this); |
42 } | 42 } |
43 return _elements; | 43 return _elements; |
44 } | 44 } |
45 | 45 |
46 // TODO: The type of value should be Collection<Element>. See http://b/5392897 | 46 void set elements(Collection<Element> value) { |
47 void set elements(value) { | |
48 final elements = this.elements; | 47 final elements = this.elements; |
49 elements.clear(); | 48 elements.clear(); |
50 elements.addAll(value); | 49 elements.addAll(value); |
51 } | 50 } |
52 | 51 |
53 String get outerHTML() { | 52 String get outerHTML() { |
54 final container = new Element.tag("div"); | 53 final container = new Element.tag("div"); |
55 // Safari requires that the clone be removed from its owner document before | 54 // Safari requires that the clone be removed from its owner document before |
56 // being inserted into the HTML document. | 55 // being inserted into the HTML document. |
57 container.elements.add(this.clone(true).remove()); | 56 container.elements.add(this.clone(true).remove()); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 182 |
184 void set lang(String value) { attributes['lang'] = value; } | 183 void set lang(String value) { attributes['lang'] = value; } |
185 | 184 |
186 String get dir() => _attr('dir'); | 185 String get dir() => _attr('dir'); |
187 | 186 |
188 void set dir(String value) { attributes['dir'] = value; } | 187 void set dir(String value) { attributes['dir'] = value; } |
189 | 188 |
190 String _attr(String name, [String def = '']) => | 189 String _attr(String name, [String def = '']) => |
191 attributes.containsKey(name) ? attributes[name] : def; | 190 attributes.containsKey(name) ? attributes[name] : def; |
192 } | 191 } |
OLD | NEW |