@typesafe-html5/typescript 0.2.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +166 -0
- package/block/article/article.ts +506 -0
- package/block/aside/aside.ts +522 -0
- package/block/audio/audio.ts +506 -0
- package/block/blockquote/blockquote.ts +522 -0
- package/block/body/body.ts +458 -0
- package/block/canvas/canvas.ts +538 -0
- package/block/caption/caption.ts +506 -0
- package/block/colgroup/colgroup.ts +154 -0
- package/block/datalist/datalist.ts +506 -0
- package/block/dd/dd.ts +506 -0
- package/block/del/del.ts +538 -0
- package/block/details/details.ts +586 -0
- package/block/dialog/dialog.ts +586 -0
- package/block/div/div.ts +586 -0
- package/block/dl/dl.ts +506 -0
- package/block/dt/dt.ts +506 -0
- package/block/embed/embed.ts +317 -0
- package/block/fieldset/fieldset.ts +570 -0
- package/block/figcaption/figcaption.ts +506 -0
- package/block/figure/figure.ts +506 -0
- package/block/footer/footer.ts +522 -0
- package/block/form/form.ts +490 -0
- package/block/h1/h1.ts +490 -0
- package/block/h2/h2.ts +490 -0
- package/block/h3/h3.ts +490 -0
- package/block/h4/h4.ts +490 -0
- package/block/h5/h5.ts +490 -0
- package/block/h6/h6.ts +490 -0
- package/block/header/header.ts +298 -0
- package/block/hgroup/hgroup.ts +506 -0
- package/block/hr/hr.ts +189 -0
- package/block/html/html.ts +106 -0
- package/block/iframe/iframe.ts +538 -0
- package/block/ins/ins.ts +538 -0
- package/block/legend/legend.ts +506 -0
- package/block/li/li.ts +602 -0
- package/block/main/main.ts +538 -0
- package/block/map/map.ts +522 -0
- package/block/menu/menu.ts +554 -0
- package/block/nav/nav.ts +554 -0
- package/block/noscript/noscript.ts +282 -0
- package/block/object/object.ts +618 -0
- package/block/ol/ol.ts +618 -0
- package/block/optgroup/optgroup.ts +522 -0
- package/block/option/option.ts +618 -0
- package/block/p/p.ts +506 -0
- package/block/picture/picture.ts +506 -0
- package/block/pre/pre.ts +506 -0
- package/block/section/section.ts +538 -0
- package/block/summary/summary.ts +570 -0
- package/block/table/table.ts +570 -0
- package/block/tbody/tbody.ts +506 -0
- package/block/td/td.ts +666 -0
- package/block/template/template.ts +506 -0
- package/block/tfoot/tfoot.ts +506 -0
- package/block/th/th.ts +682 -0
- package/block/thead/thead.ts +506 -0
- package/block/tr/tr.ts +682 -0
- package/block/ul/ul.ts +570 -0
- package/block/video/video.ts +666 -0
- package/index.ts +126 -0
- package/inline/a/a.ts +682 -0
- package/inline/abbr/abbr.ts +490 -0
- package/inline/address/address.ts +474 -0
- package/inline/b/b.ts +506 -0
- package/inline/bdi/bdi.ts +490 -0
- package/inline/bdo/bdo.ts +506 -0
- package/inline/button/button.ts +826 -0
- package/inline/cite/cite.ts +506 -0
- package/inline/code/code.ts +506 -0
- package/inline/data/data.ts +522 -0
- package/inline/dfn/dfn.ts +506 -0
- package/inline/em/em.ts +506 -0
- package/inline/i/i.ts +506 -0
- package/inline/img/img.ts +445 -0
- package/inline/input/input.ts +1197 -0
- package/inline/kbd/kbd.ts +506 -0
- package/inline/label/label.ts +538 -0
- package/inline/mark/mark.ts +506 -0
- package/inline/meter/meter.ts +554 -0
- package/inline/output/output.ts +426 -0
- package/inline/progress/progress.ts +490 -0
- package/inline/q/q.ts +522 -0
- package/inline/rp/rp.ts +506 -0
- package/inline/rt/rt.ts +506 -0
- package/inline/ruby/ruby.ts +506 -0
- package/inline/s/s.ts +506 -0
- package/inline/samp/samp.ts +506 -0
- package/inline/select/select.ts +810 -0
- package/inline/slot/slot.ts +522 -0
- package/inline/small/small.ts +506 -0
- package/inline/span/span.ts +506 -0
- package/inline/strong/strong.ts +506 -0
- package/inline/sub/sub.ts +506 -0
- package/inline/sup/sup.ts +506 -0
- package/inline/svg/svg.ts +618 -0
- package/inline/textarea/textarea.ts +874 -0
- package/inline/time/time.ts +522 -0
- package/inline/u/u.ts +506 -0
- package/inline/var/var.ts +506 -0
- package/package.json +32 -0
- package/tsconfig.json +26 -0
- package/void/area/area.ts +397 -0
- package/void/base/base.ts +61 -0
- package/void/br/br.ts +77 -0
- package/void/col/col.ts +77 -0
- package/void/head/head.ts +58 -0
- package/void/link/link.ts +253 -0
- package/void/meta/meta.ts +157 -0
- package/void/param/param.ts +93 -0
- package/void/script/script.ts +250 -0
- package/void/source/source.ts +125 -0
- package/void/style/style.ts +154 -0
- package/void/title/title.ts +58 -0
- package/void/track/track.ts +157 -0
- package/void/wbr/wbr.ts +61 -0
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
|
|
3
|
+
*
|
|
4
|
+
* @generated December 28, 2025 12:26:31
|
|
5
|
+
* @component Output
|
|
6
|
+
* @description
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface OutputProps {
|
|
10
|
+
/**
|
|
11
|
+
* Child content or elements
|
|
12
|
+
*/
|
|
13
|
+
children?: string | HTMLElement | (string | HTMLElement)[];
|
|
14
|
+
/**
|
|
15
|
+
* specifies a shortcut key (or keys) to activate or focus an element
|
|
16
|
+
*/
|
|
17
|
+
accesskey?: string | null | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Indicates whether assistive technologies should present the entire region as a whole when changes occur.
|
|
20
|
+
*/
|
|
21
|
+
'aria-atomic'?: 'false' | 'true' | boolean | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* References an element that provides additional details about the current element.
|
|
24
|
+
*/
|
|
25
|
+
'aria-details'?: string | null | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Defines keyboard shortcuts available for the element.
|
|
28
|
+
*/
|
|
29
|
+
'aria-keyshortcuts'?: string | null | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Defines how updates to the element should be announced to screen readers.
|
|
32
|
+
*/
|
|
33
|
+
'aria-live'?: 'off' | 'polite' | 'assertive' | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Indicates what content changes should be announced in a live region.
|
|
36
|
+
*/
|
|
37
|
+
'aria-relevant'?: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Provides a human-readable custom role description for assistive technologies.
|
|
40
|
+
*/
|
|
41
|
+
'aria-roledescription'?: string | null | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Represents the autocapitalize behavior of the element
|
|
44
|
+
*/
|
|
45
|
+
autocapitalize?: 'none' | 'sentences' | 'words' | 'characters' | null | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Specifies controls whether autocorrection of editable text is enabled for spelling and/or punctuation errors. Default is on.
|
|
48
|
+
*/
|
|
49
|
+
autocorrect?: 'off' | 'on' | null | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Indicates whether the element is hidden
|
|
52
|
+
*/
|
|
53
|
+
autofocus?: boolean | null | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Indicates whether the element can be edited in place
|
|
56
|
+
*/
|
|
57
|
+
contenteditable?: 'true' | 'false' | 'inherit' | boolean | null | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Represents the text direction of the element
|
|
60
|
+
*/
|
|
61
|
+
dir?: 'ltr' | 'rtl' | 'auto' | null | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Indicates whether the element is draggable
|
|
64
|
+
*/
|
|
65
|
+
draggable?: boolean | null | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Refers to the <datalist> element that contains the options for an input element.
|
|
68
|
+
*/
|
|
69
|
+
for?: string | null | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Indicates whether the element is hidden
|
|
72
|
+
*/
|
|
73
|
+
hidden?: boolean | null | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* used to specify the data entry mode for an input. It helps guide on-screen keyboards (especially on mobile devices) to show the appropriate layout for the expected input type
|
|
76
|
+
*/
|
|
77
|
+
inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'email' | 'tel' | 'url' | 'search' | null | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Specifies the primary language for the element's content
|
|
80
|
+
*/
|
|
81
|
+
lang?: string | null | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Represents a slot in a shadow DOM
|
|
84
|
+
*/
|
|
85
|
+
slot?: string | null | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Represents the spellchecking behavior of the element
|
|
88
|
+
*/
|
|
89
|
+
spellcheck?: 'true' | 'false' | boolean | null | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Represents the CSS inline style of the element
|
|
92
|
+
*/
|
|
93
|
+
style?: string | null | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Represents a tab order of the element
|
|
96
|
+
*/
|
|
97
|
+
tabindex?: number | null | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Represents a title or tooltip for the element
|
|
100
|
+
*/
|
|
101
|
+
title?: string | null | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* used to tell user agents whether the content should be translated.
|
|
104
|
+
*/
|
|
105
|
+
translate?: 'yes' | 'no' | null | undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Output -
|
|
110
|
+
*/
|
|
111
|
+
export class Output {
|
|
112
|
+
private element: HTMLElement;
|
|
113
|
+
|
|
114
|
+
constructor(props: OutputProps = {}) {
|
|
115
|
+
this.element = document.createElement('output');
|
|
116
|
+
this.applyProps(props);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private applyProps(props: OutputProps): void {
|
|
120
|
+
if (props.children !== undefined) {
|
|
121
|
+
this.setChildren(props.children);
|
|
122
|
+
}
|
|
123
|
+
if (props.accesskey !== undefined) {
|
|
124
|
+
this.element.setAttribute('accesskey', String(props.accesskey));
|
|
125
|
+
}
|
|
126
|
+
if (props['aria-atomic'] !== undefined) {
|
|
127
|
+
this.setAriaAtomic(props['aria-atomic']);
|
|
128
|
+
}
|
|
129
|
+
if (props['aria-details'] !== undefined) {
|
|
130
|
+
this.element.setAttribute('aria-details', String(props['aria-details']));
|
|
131
|
+
}
|
|
132
|
+
if (props['aria-keyshortcuts'] !== undefined) {
|
|
133
|
+
this.element.setAttribute('aria-keyshortcuts', String(props['aria-keyshortcuts']));
|
|
134
|
+
}
|
|
135
|
+
if (props['aria-live'] !== undefined) {
|
|
136
|
+
this.setAriaLive(props['aria-live']);
|
|
137
|
+
}
|
|
138
|
+
if (props['aria-relevant'] !== undefined) {
|
|
139
|
+
this.setAriaRelevant(props['aria-relevant']);
|
|
140
|
+
}
|
|
141
|
+
if (props['aria-roledescription'] !== undefined) {
|
|
142
|
+
this.element.setAttribute('aria-roledescription', String(props['aria-roledescription']));
|
|
143
|
+
}
|
|
144
|
+
if (props.autocapitalize !== undefined) {
|
|
145
|
+
this.setAutocapitalize(props.autocapitalize);
|
|
146
|
+
}
|
|
147
|
+
if (props.autocorrect !== undefined) {
|
|
148
|
+
this.setAutocorrect(props.autocorrect);
|
|
149
|
+
}
|
|
150
|
+
if (props.autofocus !== undefined) {
|
|
151
|
+
this.element.setAttribute('autofocus', String(props.autofocus));
|
|
152
|
+
}
|
|
153
|
+
if (props.contenteditable !== undefined) {
|
|
154
|
+
this.setContenteditable(props.contenteditable);
|
|
155
|
+
}
|
|
156
|
+
if (props.dir !== undefined) {
|
|
157
|
+
this.setDir(props.dir);
|
|
158
|
+
}
|
|
159
|
+
if (props.draggable !== undefined) {
|
|
160
|
+
this.element.setAttribute('draggable', String(props.draggable));
|
|
161
|
+
}
|
|
162
|
+
if (props.for !== undefined) {
|
|
163
|
+
this.element.setAttribute('for', String(props.for));
|
|
164
|
+
}
|
|
165
|
+
if (props.hidden !== undefined) {
|
|
166
|
+
this.element.setAttribute('hidden', String(props.hidden));
|
|
167
|
+
}
|
|
168
|
+
if (props.inputmode !== undefined) {
|
|
169
|
+
this.setInputmode(props.inputmode);
|
|
170
|
+
}
|
|
171
|
+
if (props.lang !== undefined) {
|
|
172
|
+
this.element.setAttribute('lang', String(props.lang));
|
|
173
|
+
}
|
|
174
|
+
if (props.slot !== undefined) {
|
|
175
|
+
this.element.setAttribute('slot', String(props.slot));
|
|
176
|
+
}
|
|
177
|
+
if (props.spellcheck !== undefined) {
|
|
178
|
+
this.setSpellcheck(props.spellcheck);
|
|
179
|
+
}
|
|
180
|
+
if (props.style !== undefined) {
|
|
181
|
+
this.element.setAttribute('style', String(props.style));
|
|
182
|
+
}
|
|
183
|
+
if (props.tabindex !== undefined) {
|
|
184
|
+
this.element.setAttribute('tabindex', String(props.tabindex));
|
|
185
|
+
}
|
|
186
|
+
if (props.title !== undefined) {
|
|
187
|
+
this.element.setAttribute('title', String(props.title));
|
|
188
|
+
}
|
|
189
|
+
if (props.translate !== undefined) {
|
|
190
|
+
this.setTranslate(props.translate);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
setAccesskey(value: string | null | undefined): this {
|
|
195
|
+
if (value === null || value === undefined) {
|
|
196
|
+
this.element.removeAttribute('accesskey');
|
|
197
|
+
} else {
|
|
198
|
+
this.element.setAttribute('accesskey', String(value));
|
|
199
|
+
}
|
|
200
|
+
return this;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
setAriaAtomic(value: 'false' | 'true' | boolean | null | undefined): this {
|
|
204
|
+
if (value === null || value === undefined) {
|
|
205
|
+
this.element.removeAttribute('aria-atomic');
|
|
206
|
+
} else {
|
|
207
|
+
this.element.setAttribute('aria-atomic', String(value));
|
|
208
|
+
}
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
setAriaDetails(value: string | null | undefined): this {
|
|
213
|
+
if (value === null || value === undefined) {
|
|
214
|
+
this.element.removeAttribute('aria-details');
|
|
215
|
+
} else {
|
|
216
|
+
this.element.setAttribute('aria-details', String(value));
|
|
217
|
+
}
|
|
218
|
+
return this;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
setAriaKeyshortcuts(value: string | null | undefined): this {
|
|
222
|
+
if (value === null || value === undefined) {
|
|
223
|
+
this.element.removeAttribute('aria-keyshortcuts');
|
|
224
|
+
} else {
|
|
225
|
+
this.element.setAttribute('aria-keyshortcuts', String(value));
|
|
226
|
+
}
|
|
227
|
+
return this;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
setAriaLive(value: 'off' | 'polite' | 'assertive' | null | undefined): this {
|
|
231
|
+
if (value === null || value === undefined) {
|
|
232
|
+
this.element.removeAttribute('aria-live');
|
|
233
|
+
} else {
|
|
234
|
+
this.element.setAttribute('aria-live', String(value));
|
|
235
|
+
}
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
setAriaRelevant(value: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined): this {
|
|
240
|
+
if (value === null || value === undefined) {
|
|
241
|
+
this.element.removeAttribute('aria-relevant');
|
|
242
|
+
} else {
|
|
243
|
+
this.element.setAttribute('aria-relevant', String(value));
|
|
244
|
+
}
|
|
245
|
+
return this;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
setAriaRoledescription(value: string | null | undefined): this {
|
|
249
|
+
if (value === null || value === undefined) {
|
|
250
|
+
this.element.removeAttribute('aria-roledescription');
|
|
251
|
+
} else {
|
|
252
|
+
this.element.setAttribute('aria-roledescription', String(value));
|
|
253
|
+
}
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
setAutocapitalize(value: 'none' | 'sentences' | 'words' | 'characters' | null | undefined): this {
|
|
258
|
+
if (value === null || value === undefined) {
|
|
259
|
+
this.element.removeAttribute('autocapitalize');
|
|
260
|
+
} else {
|
|
261
|
+
this.element.setAttribute('autocapitalize', String(value));
|
|
262
|
+
}
|
|
263
|
+
return this;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
setAutocorrect(value: 'off' | 'on' | null | undefined): this {
|
|
267
|
+
if (value === null || value === undefined) {
|
|
268
|
+
this.element.removeAttribute('autocorrect');
|
|
269
|
+
} else {
|
|
270
|
+
this.element.setAttribute('autocorrect', String(value));
|
|
271
|
+
}
|
|
272
|
+
return this;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
setAutofocus(value: boolean | null | undefined): this {
|
|
276
|
+
if (value === true) {
|
|
277
|
+
this.element.setAttribute('autofocus', '');
|
|
278
|
+
} else {
|
|
279
|
+
this.element.removeAttribute('autofocus');
|
|
280
|
+
}
|
|
281
|
+
return this;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
setContenteditable(value: 'true' | 'false' | 'inherit' | boolean | null | undefined): this {
|
|
285
|
+
if (value === null || value === undefined) {
|
|
286
|
+
this.element.removeAttribute('contenteditable');
|
|
287
|
+
} else {
|
|
288
|
+
this.element.setAttribute('contenteditable', String(value));
|
|
289
|
+
}
|
|
290
|
+
return this;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
setDir(value: 'ltr' | 'rtl' | 'auto' | null | undefined): this {
|
|
294
|
+
if (value === null || value === undefined) {
|
|
295
|
+
this.element.removeAttribute('dir');
|
|
296
|
+
} else {
|
|
297
|
+
this.element.setAttribute('dir', String(value));
|
|
298
|
+
}
|
|
299
|
+
return this;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
setDraggable(value: boolean | null | undefined): this {
|
|
303
|
+
if (value === true) {
|
|
304
|
+
this.element.setAttribute('draggable', '');
|
|
305
|
+
} else {
|
|
306
|
+
this.element.removeAttribute('draggable');
|
|
307
|
+
}
|
|
308
|
+
return this;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
setFor(value: string | null | undefined): this {
|
|
312
|
+
if (value === null || value === undefined) {
|
|
313
|
+
this.element.removeAttribute('for');
|
|
314
|
+
} else {
|
|
315
|
+
this.element.setAttribute('for', String(value));
|
|
316
|
+
}
|
|
317
|
+
return this;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
setHidden(value: boolean | null | undefined): this {
|
|
321
|
+
if (value === true) {
|
|
322
|
+
this.element.setAttribute('hidden', '');
|
|
323
|
+
} else {
|
|
324
|
+
this.element.removeAttribute('hidden');
|
|
325
|
+
}
|
|
326
|
+
return this;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
setInputmode(value: 'none' | 'text' | 'decimal' | 'numeric' | 'email' | 'tel' | 'url' | 'search' | null | undefined): this {
|
|
330
|
+
if (value === null || value === undefined) {
|
|
331
|
+
this.element.removeAttribute('inputmode');
|
|
332
|
+
} else {
|
|
333
|
+
this.element.setAttribute('inputmode', String(value));
|
|
334
|
+
}
|
|
335
|
+
return this;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
setLang(value: string | null | undefined): this {
|
|
339
|
+
if (value === null || value === undefined) {
|
|
340
|
+
this.element.removeAttribute('lang');
|
|
341
|
+
} else {
|
|
342
|
+
this.element.setAttribute('lang', String(value));
|
|
343
|
+
}
|
|
344
|
+
return this;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
setSlot(value: string | null | undefined): this {
|
|
348
|
+
if (value === null || value === undefined) {
|
|
349
|
+
this.element.removeAttribute('slot');
|
|
350
|
+
} else {
|
|
351
|
+
this.element.setAttribute('slot', String(value));
|
|
352
|
+
}
|
|
353
|
+
return this;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
setSpellcheck(value: 'true' | 'false' | boolean | null | undefined): this {
|
|
357
|
+
if (value === null || value === undefined) {
|
|
358
|
+
this.element.removeAttribute('spellcheck');
|
|
359
|
+
} else {
|
|
360
|
+
this.element.setAttribute('spellcheck', String(value));
|
|
361
|
+
}
|
|
362
|
+
return this;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
setStyle(value: string | null | undefined): this {
|
|
366
|
+
if (value === null || value === undefined) {
|
|
367
|
+
this.element.removeAttribute('style');
|
|
368
|
+
} else {
|
|
369
|
+
this.element.setAttribute('style', String(value));
|
|
370
|
+
}
|
|
371
|
+
return this;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
setTabindex(value: number | null | undefined): this {
|
|
375
|
+
if (value === null || value === undefined) {
|
|
376
|
+
this.element.removeAttribute('tabindex');
|
|
377
|
+
} else {
|
|
378
|
+
this.element.setAttribute('tabindex', String(value));
|
|
379
|
+
}
|
|
380
|
+
return this;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
setTitle(value: string | null | undefined): this {
|
|
384
|
+
if (value === null || value === undefined) {
|
|
385
|
+
this.element.removeAttribute('title');
|
|
386
|
+
} else {
|
|
387
|
+
this.element.setAttribute('title', String(value));
|
|
388
|
+
}
|
|
389
|
+
return this;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
setTranslate(value: 'yes' | 'no' | null | undefined): this {
|
|
393
|
+
if (value === null || value === undefined) {
|
|
394
|
+
this.element.removeAttribute('translate');
|
|
395
|
+
} else {
|
|
396
|
+
this.element.setAttribute('translate', String(value));
|
|
397
|
+
}
|
|
398
|
+
return this;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
setChildren(children: string | HTMLElement | (string | HTMLElement)[]): this {
|
|
402
|
+
// Clear existing children
|
|
403
|
+
while (this.element.firstChild) {
|
|
404
|
+
this.element.removeChild(this.element.firstChild);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (typeof children === 'string') {
|
|
408
|
+
this.element.textContent = children;
|
|
409
|
+
} else if (Array.isArray(children)) {
|
|
410
|
+
children.forEach(child => {
|
|
411
|
+
if (typeof child === 'string') {
|
|
412
|
+
this.element.appendChild(document.createTextNode(child));
|
|
413
|
+
} else {
|
|
414
|
+
this.element.appendChild(child);
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
} else {
|
|
418
|
+
this.element.appendChild(children);
|
|
419
|
+
}
|
|
420
|
+
return this;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
getElement(): HTMLElement {
|
|
424
|
+
return this.element;
|
|
425
|
+
}
|
|
426
|
+
}
|