OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 html; | 5 part of html; |
6 | 6 |
7 /** | 7 /** |
8 * A set (union) of the CSS classes that are present in a set of elements. | 8 * A set (union) of the CSS classes that are present in a set of elements. |
9 * Implemented separately from _ElementCssClassSet for performance. | 9 * Implemented separately from _ElementCssClassSet for performance. |
10 */ | 10 */ |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 class _ElementCssClassSet extends CssClassSetImpl { | 68 class _ElementCssClassSet extends CssClassSetImpl { |
69 final Element _element; | 69 final Element _element; |
70 | 70 |
71 _ElementCssClassSet(this._element); | 71 _ElementCssClassSet(this._element); |
72 | 72 |
73 Set<String> readClasses() { | 73 Set<String> readClasses() { |
74 var s = new LinkedHashSet<String>(); | 74 var s = new LinkedHashSet<String>(); |
75 var classname = _element.className; | 75 var classname = _element.className; |
| 76 if (classname is svg.AnimatedString) { |
| 77 classname = classname.baseVal; |
| 78 } |
76 | 79 |
77 for (String name in classname.split(' ')) { | 80 for (String name in classname.split(' ')) { |
78 String trimmed = name.trim(); | 81 String trimmed = name.trim(); |
79 if (!trimmed.isEmpty) { | 82 if (!trimmed.isEmpty) { |
80 s.add(trimmed); | 83 s.add(trimmed); |
81 } | 84 } |
82 } | 85 } |
83 return s; | 86 return s; |
84 } | 87 } |
85 | 88 |
86 void writeClasses(Set<String> s) { | 89 void writeClasses(Set<String> s) { |
87 _element.className = s.join(' '); | 90 _element.className = s.join(' '); |
88 } | 91 } |
89 } | 92 } |
OLD | NEW |