-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
302 lines (290 loc) · 8.85 KB
/
index.md
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
---
title: SVGStringList
slug: Web/API/SVGStringList
page-type: web-api-interface
browser-compat: api.SVGStringList
---
{{APIRef("SVG")}}
## SVG string list interface
The `SVGStringList` defines a list of strings.
An `SVGStringList` object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown.
### Interface overview
<table class="no-markdown">
<tbody>
<tr>
<th scope="row">Also implement</th>
<td><em>None</em></td>
</tr>
<tr>
<th scope="row">Methods</th>
<td>
<ul>
<li><code>void clear()</code></li>
<li>
string
<code>initialize(string <em>newItem</em>)</code>
</li>
<li>
string
<code>getItem(number <em>index</em>)</code>
</li>
<li>
string
<code>insertItemBefore(string <em>newItem</em>, number <em>index</em>)</code>
</li>
<li>
string
<code>replaceItem(string <em>newItem</em>,
number <em>index</em>)</code>
</li>
<li>
string
<code>removeItem(number <em>index</em>)</code>
</li>
<li>
string
<code>appendItem(string <em>newItem</em>)</code>
</li>
</ul>
</td>
</tr>
<tr>
<th scope="row">Properties</th>
<td>
<ul>
<li>readonly unsigned long <code>numberOfItems</code></li>
<li>
readonly unsigned long
<code>length</code> {{non-standard_inline}}
</li>
</ul>
</td>
</tr>
<tr>
<th scope="row">Normative document</th>
<td>
<a href="https://www.w3.org/TR/SVG11/types.html#InterfaceSVGStringList"
>SVG 1.1 (2nd Edition)</a
>
</td>
</tr>
</tbody>
</table>
## Instance properties
<table class="no-markdown">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>numberOfItems</code></td>
<td><code>unsigned long</code></td>
<td>The number of items in the list.</td>
</tr>
<tr>
<td><code>length</code></td>
<td><code>unsigned long</code></td>
<td>
A mirror of the value in <code>numberOfItems</code>, for consistency
with other interfaces. {{non-standard_inline}}
</td>
</tr>
</tbody>
</table>
## Instance methods
<table class="no-markdown">
<thead>
<tr>
<th>Name & Arguments</th>
<th>Return</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code><strong>clear</strong>()</code>
</td>
<td><em>void</em></td>
<td>
<p>
Clears all existing current items from the list, with the result being
an empty list.
</p>
<p><strong>Exceptions:</strong></p>
<ul>
<li>
a {{domxref("DOMException")}} with code
<code>NO_MODIFICATION_ALLOWED_ERR</code> is raised when the list
corresponds to a read only attribute or when the object itself is
read only.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<code><strong>initialize</strong>(string <em>newItem</em>)</code>
</td>
<td>string</td>
<td>
<p>
Clears all existing current items from the list and re-initializes the
list to hold the single item specified by the parameter. If the
inserted item is already in a list, it is removed from its previous
list before it is inserted into this list. The inserted item is the
item itself and not a copy. The return value is the item inserted into
the list.
</p>
<p><strong>Exceptions:</strong></p>
<ul>
<li>
a {{domxref("DOMException")}} with code
<code>NO_MODIFICATION_ALLOWED_ERR</code> is raised when the list
corresponds to a read only attribute or when the object itself is
read only.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<code><strong>getItem</strong>(number <em>index</em>)</code>
</td>
<td>string</td>
<td>
<p>
Returns the specified item from the list. The returned item is the
item itself and not a copy. Any changes made to the item are
immediately reflected in the list. The first item is number 0.
</p>
<p><strong>Exceptions:</strong></p>
<ul>
<li>
a {{domxref("DOMException")}} with code
<code>NO_MODIFICATION_ALLOWED_ERR</code> is raised when the list
corresponds to a read only attribute or when the object itself is
read only.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<code
><strong>insertItemBefore</strong>(string <em>newItem</em>, number <em>index</em>)</code>
</td>
<td>string</td>
<td>
<p>
Inserts a new item into the list at the specified position. The first
item is number 0. If <code>newItem</code> is already in a list, it is
removed from its previous list before it is inserted into this list.
The inserted item is the item itself and not a copy. If the item is
already in this list, note that the index of the item to insert before
is before the removal of the item. If the <code>index</code> is equal
to 0, then the new item is inserted at the front of the list. If the
index is greater than or equal to <code>numberOfItems</code>, then the
new item is appended to the end of the list.
</p>
<p><strong>Exceptions:</strong></p>
<ul>
<li>
a {{domxref("DOMException")}} with code
<code>NO_MODIFICATION_ALLOWED_ERR</code> is raised when the list
corresponds to a read only attribute or when the object itself is
read only.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<code
><strong>replaceItem</strong>(string <em>newItem</em>, number <em>index</em>)</code
>
</td>
<td>string</td>
<td>
<p>
Replaces an existing item in the list with a new item. If
<code>newItem</code> is already in a list, it is removed from its
previous list before it is inserted into this list. The inserted item
is the item itself and not a copy. If the item is already in this
list, note that the index of the item to replace is before the removal
of the item.
</p>
<p><strong>Exceptions:</strong></p>
<ul>
<li>
a {{domxref("DOMException")}} with code
<code>NO_MODIFICATION_ALLOWED_ERR</code> is raised when the list
corresponds to a read only attribute or when the object itself is
read only.
</li>
<li>
a {{domxref("DOMException")}} with code
<code>INDEX_SIZE_ERR</code> is raised if the index number is greater
than or equal to <code>numberOfItems</code>.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<code
><strong>removeItem</strong>(in unsigned long <em>index</em>)</code
>
</td>
<td>string</td>
<td>
<p>Removes an existing item from the list.</p>
<p><strong>Exceptions:</strong></p>
<ul>
<li>
a {{domxref("DOMException")}} with code
<code>NO_MODIFICATION_ALLOWED_ERR</code> is raised when the list
corresponds to a read only attribute or when the object itself is
read only.
</li>
<li>
a {{domxref("DOMException")}} with code
<code>INDEX_SIZE_ERR</code> is raised if the index number is greater
than or equal to <code>numberOfItems</code>.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<code
><strong>appendItem</strong>(string <em>newItem</em>)</code
>
</td>
<td>string</td>
<td>
<p>
Inserts a new item at the end of the list. If <code>newItem</code> is
already in a list, it is removed from its previous list before it is
inserted into this list. The inserted item is the item itself and not
a copy.
</p>
<p><strong>Exceptions:</strong></p>
<ul>
<li>
a {{domxref("DOMException")}} with code
<code>NO_MODIFICATION_ALLOWED_ERR</code> is raised when the list
corresponds to a read only attribute or when the object itself is
read only.
</li>
</ul>
</td>
</tr>
</tbody>
</table>
## Browser compatibility
{{Compat}}