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 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 class _AttributeClassSet extends CssClassSetImpl { | 7 class _AttributeClassSet extends CssClassSetImpl { |
8 final Element _element; | 8 final Element _element; |
9 | 9 |
10 _AttributeClassSet(this._element); | 10 _AttributeClassSet(this._element); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (match != null && match.group(1).toLowerCase() == 'svg') { | 47 if (match != null && match.group(1).toLowerCase() == 'svg') { |
48 parentElement = document.body; | 48 parentElement = document.body; |
49 } else { | 49 } else { |
50 parentElement = new SvgSvgElement(); | 50 parentElement = new SvgSvgElement(); |
51 } | 51 } |
52 var fragment = parentElement.createFragment(svg, validator: validator, | 52 var fragment = parentElement.createFragment(svg, validator: validator, |
53 treeSanitizer: treeSanitizer); | 53 treeSanitizer: treeSanitizer); |
54 return fragment.nodes.where((e) => e is SvgElement).single; | 54 return fragment.nodes.where((e) => e is SvgElement).single; |
55 } | 55 } |
56 | 56 |
57 _AttributeClassSet _cssClassSet; | 57 CssClassSet get classes => new _AttributeClassSet(this); |
58 CssClassSet get classes { | |
59 if (_cssClassSet == null) { | |
60 _cssClassSet = new _AttributeClassSet(this); | |
61 } | |
62 return _cssClassSet; | |
63 } | |
64 | 58 |
65 List<Element> get children => new FilteredElementList<Element>(this); | 59 List<Element> get children => new FilteredElementList<Element>(this); |
66 | 60 |
67 void set children(List<Element> value) { | 61 void set children(List<Element> value) { |
68 final children = this.children; | 62 final children = this.children; |
69 children.clear(); | 63 children.clear(); |
70 children.addAll(value); | 64 children.addAll(value); |
71 } | 65 } |
72 | 66 |
73 String get outerHtml { | 67 String get outerHtml { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 * Checks to see if the SVG element type is supported by the current platform. | 137 * Checks to see if the SVG element type is supported by the current platform. |
144 * | 138 * |
145 * The tag should be a valid SVG element tag name. | 139 * The tag should be a valid SVG element tag name. |
146 */ | 140 */ |
147 static bool isTagSupported(String tag) { | 141 static bool isTagSupported(String tag) { |
148 var e = new $CLASSNAME.tag(tag); | 142 var e = new $CLASSNAME.tag(tag); |
149 return e is $CLASSNAME && !(e is UnknownElement); | 143 return e is $CLASSNAME && !(e is UnknownElement); |
150 } | 144 } |
151 $!MEMBERS | 145 $!MEMBERS |
152 } | 146 } |
OLD | NEW |