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 _SVGClassSet extends _CssClassSet { | 5 class _SVGClassSet extends _CssClassSet { |
6 _SVGClassSet(element) : super(element); | 6 _SVGClassSet(element) : super(element); |
7 | 7 |
8 String _className() => _element.className.baseVal; | 8 String _className() => _element.className.baseVal; |
9 | 9 |
10 void _write(Set s) { | 10 void _write(Set s) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 void set xmlbase(String value) { _ptr.xmlbase = value; } | 55 void set xmlbase(String value) { _ptr.xmlbase = value; } |
56 | 56 |
57 ElementList get elements() { | 57 ElementList get elements() { |
58 if (_elements == null) { | 58 if (_elements == null) { |
59 _elements = new FilteredElementList(this); | 59 _elements = new FilteredElementList(this); |
60 } | 60 } |
61 return _elements; | 61 return _elements; |
62 } | 62 } |
63 | 63 |
64 // TODO: The type of value should be Collection<Element>. See http://b/5392897 | 64 void set elements(Collection<Element> value) { |
65 void set elements(value) { | |
66 final elements = this.elements; | 65 final elements = this.elements; |
67 elements.clear(); | 66 elements.clear(); |
68 elements.addAll(value); | 67 elements.addAll(value); |
69 } | 68 } |
70 | 69 |
71 String get outerHTML() { | 70 String get outerHTML() { |
72 final container = new Element.tag("div"); | 71 final container = new Element.tag("div"); |
73 container.elements.add(this.clone(true)); | 72 container.elements.add(this.clone(true)); |
74 return container.innerHTML; | 73 return container.innerHTML; |
75 } | 74 } |
76 | 75 |
77 String get innerHTML() { | 76 String get innerHTML() { |
78 final container = new Element.tag("div"); | 77 final container = new Element.tag("div"); |
79 container.elements.addAll(this.clone(true).elements); | 78 container.elements.addAll(this.clone(true).elements); |
80 return container.innerHTML; | 79 return container.innerHTML; |
81 } | 80 } |
82 | 81 |
83 void set innerHTML(String svg) { | 82 void set innerHTML(String svg) { |
84 var container = new Element.tag("div"); | 83 var container = new Element.tag("div"); |
85 // Wrap the SVG string in <svg> so that SVGElements are created, rather than | 84 // Wrap the SVG string in <svg> so that SVGElements are created, rather than |
86 // HTMLElements. | 85 // HTMLElements. |
87 container.innerHTML = '<svg version="1.1">$svg</svg>'; | 86 container.innerHTML = '<svg version="1.1">$svg</svg>'; |
88 this.elements = container.elements.first.elements; | 87 this.elements = container.elements.first.elements; |
89 } | 88 } |
90 | 89 |
91 SVGElement clone(bool deep) => super.clone(deep); | 90 SVGElement clone(bool deep) => super.clone(deep); |
92 } | 91 } |
OLD | NEW |