| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 bool any(bool f(String element)) => readClasses().any(f); | 55 bool any(bool f(String element)) => readClasses().any(f); |
| 56 | 56 |
| 57 bool get isEmpty => readClasses().isEmpty; | 57 bool get isEmpty => readClasses().isEmpty; |
| 58 | 58 |
| 59 int get length => readClasses().length; | 59 int get length => readClasses().length; |
| 60 | 60 |
| 61 dynamic reduce(dynamic initialValue, | 61 dynamic reduce(dynamic initialValue, |
| 62 dynamic combine(dynamic previousValue, String element)) { | 62 dynamic combine(dynamic previousValue, String element)) { |
| 63 return readClasses().reduce(initialValue, combine); | 63 return readClasses().reduce(initialValue, combine); |
| 64 } | 64 } |
| 65 |
| 66 dynamic fold(dynamic initialValue, |
| 67 dynamic combine(dynamic previousValue, String element)) { |
| 68 return readClasses().fold(initialValue, combine); |
| 69 } |
| 65 // interface Collection - END | 70 // interface Collection - END |
| 66 | 71 |
| 67 // interface Set - BEGIN | 72 // interface Set - BEGIN |
| 68 /** | 73 /** |
| 69 * Determine if this element contains the class [value]. | 74 * Determine if this element contains the class [value]. |
| 70 * | 75 * |
| 71 * This is the Dart equivalent of jQuery's | 76 * This is the Dart equivalent of jQuery's |
| 72 * [hasClass](http://api.jquery.com/hasClass/). | 77 * [hasClass](http://api.jquery.com/hasClass/). |
| 73 */ | 78 */ |
| 74 bool contains(String value) => readClasses().contains(value); | 79 bool contains(String value) => readClasses().contains(value); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 */ | 215 */ |
| 211 Set<String> readClasses(); | 216 Set<String> readClasses(); |
| 212 | 217 |
| 213 /** | 218 /** |
| 214 * Join all the elements of a set into one string and write | 219 * Join all the elements of a set into one string and write |
| 215 * back to the element. | 220 * back to the element. |
| 216 * This is intended to be overridden by specific implementations. | 221 * This is intended to be overridden by specific implementations. |
| 217 */ | 222 */ |
| 218 void writeClasses(Set<String> s); | 223 void writeClasses(Set<String> s); |
| 219 } | 224 } |
| OLD | NEW |