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_common; | 5 part of html_common; |
6 | 6 |
7 abstract class CssClassSetImpl implements CssClassSet { | 7 abstract class CssClassSetImpl implements CssClassSet { |
8 | 8 |
9 String toString() { | 9 String toString() { |
10 return readClasses().join(' '); | 10 return readClasses().join(' '); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 readClasses().skipWhile(test); | 186 readClasses().skipWhile(test); |
187 String firstWhere(bool test(String value), { String orElse() }) => | 187 String firstWhere(bool test(String value), { String orElse() }) => |
188 readClasses().firstWhere(test, orElse: orElse); | 188 readClasses().firstWhere(test, orElse: orElse); |
189 String lastWhere(bool test(String value), { String orElse()}) => | 189 String lastWhere(bool test(String value), { String orElse()}) => |
190 readClasses().lastWhere(test, orElse: orElse); | 190 readClasses().lastWhere(test, orElse: orElse); |
191 String singleWhere(bool test(String value)) => | 191 String singleWhere(bool test(String value)) => |
192 readClasses().singleWhere(test); | 192 readClasses().singleWhere(test); |
193 String elementAt(int index) => readClasses().elementAt(index); | 193 String elementAt(int index) => readClasses().elementAt(index); |
194 | 194 |
195 void clear() { | 195 void clear() { |
| 196 // TODO(sra): Do this without reading the classes. |
196 modify((s) => s.clear()); | 197 modify((s) => s.clear()); |
197 } | 198 } |
198 // interface Set - END | 199 // interface Set - END |
199 | 200 |
200 /** | 201 /** |
201 * Helper method used to modify the set of css classes on this element. | 202 * Helper method used to modify the set of css classes on this element. |
202 * | 203 * |
203 * f - callback with: | 204 * f - callback with: |
204 * s - a Set of all the css class name currently on this element. | 205 * s - a Set of all the css class name currently on this element. |
205 * | 206 * |
(...skipping 14 matching lines...) Expand all Loading... |
220 */ | 221 */ |
221 Set<String> readClasses(); | 222 Set<String> readClasses(); |
222 | 223 |
223 /** | 224 /** |
224 * Join all the elements of a set into one string and write | 225 * Join all the elements of a set into one string and write |
225 * back to the element. | 226 * back to the element. |
226 * This is intended to be overridden by specific implementations. | 227 * This is intended to be overridden by specific implementations. |
227 */ | 228 */ |
228 void writeClasses(Set<String> s); | 229 void writeClasses(Set<String> s); |
229 } | 230 } |
OLD | NEW |