-
Notifications
You must be signed in to change notification settings - Fork 0
/
DOMTokenList.cljs
185 lines (128 loc) · 5.09 KB
/
DOMTokenList.cljs
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
(ns web.dom.DOMTokenList
"The DOMTokenList interface represents a set of space-separated
Such a set is returned by `Element.classList`, `HTMLLinkElement.relList`,
`HTMLAreaElement.relList`, `HTMLIframeElement.sandbox`, or `HTMLOutputElement.htmlFor`.
is indexed beginning with 0 as with JavaScript `js.Array` objects.
is always case-sensitive."
(:refer-clojure :exclude [remove replace keys]))
(defn item
"Method.
The item() method of the `web.dom.DOMTokenList` interface returns
item in the list by its index.
`tokenList.item(index);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/item`"
[this index]
(-> this (.item index)))
(defn contains
"Method.
The contains() method of the `web.dom.DOMTokenList` interface
a `js.Boolean` — true if the underlying list contains the given
otherwise false.
`tokenList.contains(token);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/contains`"
[this token]
(-> this (.contains token)))
(defn add
"Method.
The add() method of the `web.dom.DOMTokenList` interface adds
given token to the list.
`tokenList.add(token1[, token2[, ...]]);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add`"
[this & args]
(-> this .-add (.apply this (clj->js args))))
(defn remove
"Method.
The remove() method of the `web.dom.DOMTokenList` interface removes
specified tokens from the list.
`tokenList.remove(token1[, token2[, ...]]);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove`"
[this & args]
(-> this .-remove (.apply this (clj->js args))))
(defn replace
"Method.
The replace() method of the `web.dom.DOMTokenList` interface
an existing token with a new token.
`tokenList.replace(oldToken,newToken);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/replace`"
[this old-token new-token]
(-> this (.replace old-token new-token)))
(defn supports
"Method.
The supports() method of the `web.dom.DOMTokenList` interface
true if a given token is in the associated attribute's supported
This method is intended to support feature detection.
`var boolean = element.supports(token)`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/supports`"
[this token]
(-> this (.supports token)))
(defn toggle
"Method.
The toggle() method of the `web.dom.DOMTokenList` interface removes
given token from the list and returns false. If token doesn't
it's added and the function returns true.
`tokenList.toggle(token, force);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/toggle`"
[this token force]
(-> this (.toggle token force)))
(defn entries
"Method.
The DOMTokenList.entries() method returns an `iterator` allowing
to go through all key/value pairs contained in this object. The
are `web.dom.DOMString` objects, each representing a single token.
`tokenList.entries();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/entries`"
[this ]
(-> this (.entries)))
(defn for-each
"Method.
The forEach() method of the `web.dom.DOMTokenList` interface
the callback given in parameter once for each value pair in the
in insertion order.
`tokenList.forEach(callback);
tokenList.forEach(callback, argument);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/forEach`"
[this & args]
(-> this .-forEach (.apply this (clj->js args))))
(defn keys
"Method.
The keys() method of the `web.dom.DOMTokenList` interface returns
`iterator` allowing to go through all keys contained in this
The keys are of type unsigned integer.
`tokenList.keys();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/keys`"
[this ]
(-> this (.keys)))
(defn values
"Method.
The values() method of the `web.dom.DOMTokenList` interface returns
`iterator` allowing developers to go through all values contained
the DOMTokenList. The individual values are `web.dom.DOMString`
`tokenList.values();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/values`"
[this ]
(-> this (.values)))
(defn value
"Method.
The value property of the `web.dom.DOMTokenList` interface returns
value of the list as a `web.dom.DOMString`, or clears and sets
list to the given value.
`tokenList.value;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/value`"
[this ]
(-> this (.value)))
(defn length
"Property.
The length read-only property of the `web.dom.DOMTokenList` interface
an integer representing the number of objects stored in the object.
`tokenList.length;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/length`"
[this]
(-> this (.-length)))
(defn set-length!
"Property.
The length read-only property of the `web.dom.DOMTokenList` interface
an integer representing the number of objects stored in the object.
`tokenList.length;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/length`"
[this val]
(aset this "length" val))