-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathCssClassSet.dart
113 lines (104 loc) · 3.92 KB
/
CssClassSet.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
part of html;
/** A Set that stores the CSS class names for an element. */
abstract class CssClassSet implements Set<String> {
/**
* Adds the class [value] to the element if it is not on it, removes it if it
* is.
*
* If [shouldAdd] is true, then we always add that [value] to the element. If
* [shouldAdd] is false then we always remove [value] from the element.
*
* If this corresponds to one element, returns `true` if [value] is present
* after the operation, and returns `false` if [value] is absent after the
* operation.
*
* If this CssClassSet corresponds to many elements, `false` is always
* returned.
*
* [value] must be a valid 'token' representing a single class, i.e. a
* non-empty string containing no whitespace. To toggle multiple classes, use
* [toggleAll].
*/
bool toggle(String value, [bool? shouldAdd]);
/**
* Returns [:true:] if classes cannot be added or removed from this
* [:CssClassSet:].
*/
bool get frozen;
/**
* Determine if this element contains the class [value].
*
* This is the Dart equivalent of jQuery's
* [hasClass](http://api.jquery.com/hasClass/).
*
* [value] must be a valid 'token' representing a single class, i.e. a
* non-empty string containing no whitespace.
*/
bool contains(Object? value);
/**
* Add the class [value] to element.
*
* [add] and [addAll] are the Dart equivalent of jQuery's
* [addClass](http://api.jquery.com/addClass/).
*
* If this CssClassSet corresponds to one element. Returns true if [value] was
* added to the set, otherwise false.
*
* If this CssClassSet corresponds to many elements, `false` is always
* returned.
*
* [value] must be a valid 'token' representing a single class, i.e. a
* non-empty string containing no whitespace. To add multiple classes use
* [addAll].
*/
bool add(String value);
/**
* Remove the class [value] from element, and return true on successful
* removal.
*
* [remove] and [removeAll] are the Dart equivalent of jQuery's
* [removeClass](http://api.jquery.com/removeClass/).
*
* [value] must be a valid 'token' representing a single class, i.e. a
* non-empty string containing no whitespace. To remove multiple classes, use
* [removeAll].
*/
bool remove(Object? value);
/**
* Add all classes specified in [iterable] to element.
*
* [add] and [addAll] are the Dart equivalent of jQuery's
* [addClass](http://api.jquery.com/addClass/).
*
* Each element of [iterable] must be a valid 'token' representing a single
* class, i.e. a non-empty string containing no whitespace.
*/
void addAll(Iterable<String> iterable);
/**
* Remove all classes specified in [iterable] from element.
*
* [remove] and [removeAll] are the Dart equivalent of jQuery's
* [removeClass](http://api.jquery.com/removeClass/).
*
* Each element of [iterable] must be a valid 'token' representing a single
* class, i.e. a non-empty string containing no whitespace.
*/
void removeAll(Iterable<Object?> iterable);
/**
* Toggles all classes specified in [iterable] on element.
*
* Iterate through [iterable]'s items, and add it if it is not on it, or
* remove it if it is. This is the Dart equivalent of jQuery's
* [toggleClass](http://api.jquery.com/toggleClass/).
* If [shouldAdd] is true, then we always add all the classes in [iterable]
* element. If [shouldAdd] is false then we always remove all the classes in
* [iterable] from the element.
*
* Each element of [iterable] must be a valid 'token' representing a single
* class, i.e. a non-empty string containing no whitespace.
*/
void toggleAll(Iterable<String> iterable, [bool? shouldAdd]);
}