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 part of html; | 5 part of html; |
6 | 6 |
7 abstract class CssClassSet implements Set<String> { | 7 abstract class CssClassSet implements Set<String> { |
8 | 8 |
9 String toString() { | 9 String toString() { |
10 return readClasses().join(' '); | 10 return readClasses().join(' '); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 void removeWhere(bool test(String name)) { | 143 void removeWhere(bool test(String name)) { |
144 _modify((s) => s.removeWhere(test)); | 144 _modify((s) => s.removeWhere(test)); |
145 } | 145 } |
146 | 146 |
147 void retainWhere(bool test(String name)) { | 147 void retainWhere(bool test(String name)) { |
148 _modify((s) => s.retainWhere(test)); | 148 _modify((s) => s.retainWhere(test)); |
149 } | 149 } |
150 | 150 |
151 bool isSubsetOf(Collection<String> collection) => | |
152 readClasses().isSubsetOf(collection); | |
153 | |
154 bool containsAll(Iterable<String> collection) => | 151 bool containsAll(Iterable<String> collection) => |
155 readClasses().containsAll(collection); | 152 readClasses().containsAll(collection); |
156 | 153 |
157 Set<String> intersection(Set<String> other) => | 154 Set<String> intersection(Set<String> other) => |
158 readClasses().intersection(other); | 155 readClasses().intersection(other); |
159 | 156 |
160 Set<String> union(Set<String> other) => | 157 Set<String> union(Set<String> other) => |
161 readClasses().union(other); | 158 readClasses().union(other); |
162 | 159 |
163 Set<String> difference(Set<String> other) => | 160 Set<String> difference(Set<String> other) => |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 */ | 207 */ |
211 Set<String> readClasses(); | 208 Set<String> readClasses(); |
212 | 209 |
213 /** | 210 /** |
214 * Join all the elements of a set into one string and write | 211 * Join all the elements of a set into one string and write |
215 * back to the element. | 212 * back to the element. |
216 * This is intended to be overridden by specific implementations. | 213 * This is intended to be overridden by specific implementations. |
217 */ | 214 */ |
218 void writeClasses(Set<String> s); | 215 void writeClasses(Set<String> s); |
219 } | 216 } |
OLD | NEW |