| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 factory XMLElementWrappingImplementation.xml(String xml) { | 23 factory XMLElementWrappingImplementation.xml(String xml) { |
| 24 XMLElement parentTag = new XMLElement.tag('xml'); | 24 XMLElement parentTag = new XMLElement.tag('xml'); |
| 25 parentTag.innerHTML = xml; | 25 parentTag.innerHTML = xml; |
| 26 if (parentTag.nodes.length == 1) return parentTag.nodes.removeLast(); | 26 if (parentTag.nodes.length == 1) return parentTag.nodes.removeLast(); |
| 27 | 27 |
| 28 throw new IllegalArgumentException( | 28 throw new IllegalArgumentException( |
| 29 'XML had ${parentTag.nodes.length} top-level nodes but 1 expected'); | 29 'XML had ${parentTag.nodes.length} top-level nodes but 1 expected'); |
| 30 } | 30 } |
| 31 | 31 |
| 32 Set<String> get classes() { | 32 CSSClassSet get classes() { |
| 33 if (_cssClassSet === null) { | 33 if (_cssClassSet === null) { |
| 34 _cssClassSet = new _XMLClassSet(_ptr); | 34 _cssClassSet = new _XMLClassSet(_ptr); |
| 35 } | 35 } |
| 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 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 void set lang(String value) { attributes['lang'] = value; } | 183 void set lang(String value) { attributes['lang'] = value; } |
| 184 | 184 |
| 185 String get dir() => _attr('dir'); | 185 String get dir() => _attr('dir'); |
| 186 | 186 |
| 187 void set dir(String value) { attributes['dir'] = value; } | 187 void set dir(String value) { attributes['dir'] = value; } |
| 188 | 188 |
| 189 String _attr(String name, [String def = '']) => | 189 String _attr(String name, [String def = '']) => |
| 190 attributes.containsKey(name) ? attributes[name] : def; | 190 attributes.containsKey(name) ? attributes[name] : def; |
| 191 } | 191 } |
| OLD | NEW |