@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,490 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTOGENERATED. DO NOT EDIT IT.
|
|
3
|
+
*
|
|
4
|
+
* @generated December 28, 2025 12:26:31
|
|
5
|
+
* @component Form
|
|
6
|
+
* @description
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface FormProps {
|
|
10
|
+
/**
|
|
11
|
+
* Child content or elements
|
|
12
|
+
*/
|
|
13
|
+
children?: string | HTMLElement | (string | HTMLElement)[];
|
|
14
|
+
/**
|
|
15
|
+
* Specifies the character encodings that are to be used for form submission.
|
|
16
|
+
*/
|
|
17
|
+
'accept-charset'?: string | null | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* specifies a shortcut key (or keys) to activate or focus an element
|
|
20
|
+
*/
|
|
21
|
+
accesskey?: string | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Specifies the URL where the form data should be submitted when the form is submitted.
|
|
24
|
+
*/
|
|
25
|
+
action?: string | null | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Indicates whether assistive technologies should present the entire region as a whole when changes occur.
|
|
28
|
+
*/
|
|
29
|
+
'aria-atomic'?: 'false' | 'true' | boolean | null | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* References an element that provides additional details about the current element.
|
|
32
|
+
*/
|
|
33
|
+
'aria-details'?: string | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Indicates that the value entered does not conform to the expected format.
|
|
36
|
+
*/
|
|
37
|
+
'aria-invalid'?: 'false' | 'true' | 'grammar' | 'spelling' | boolean | null | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Defines keyboard shortcuts available for the element.
|
|
40
|
+
*/
|
|
41
|
+
'aria-keyshortcuts'?: string | null | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Defines a string value that labels the current element for assistive technologies.
|
|
44
|
+
*/
|
|
45
|
+
'aria-label'?: string | null | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Defines how updates to the element should be announced to screen readers.
|
|
48
|
+
*/
|
|
49
|
+
'aria-live'?: 'off' | 'polite' | 'assertive' | null | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Indicates what content changes should be announced in a live region.
|
|
52
|
+
*/
|
|
53
|
+
'aria-relevant'?: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Provides a human-readable custom role description for assistive technologies.
|
|
56
|
+
*/
|
|
57
|
+
'aria-roledescription'?: string | null | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Specifies whether a form or input field should have autocomplete enabled. Default is on.
|
|
60
|
+
*/
|
|
61
|
+
autocomplete?: 'off' | 'on' | null | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Specifies controls whether autocorrection of editable text is enabled for spelling and/or punctuation errors. Default is on.
|
|
64
|
+
*/
|
|
65
|
+
autocorrect?: 'off' | 'on' | null | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Represents the text direction of the element
|
|
68
|
+
*/
|
|
69
|
+
dir?: 'ltr' | 'rtl' | 'auto' | null | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Indicates whether the element is draggable
|
|
72
|
+
*/
|
|
73
|
+
draggable?: boolean | null | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Specifies how form data should be encoded before sending it to a server. Only used if the method attribute is set to post. Default is application/x-www-form-urlencoded.
|
|
76
|
+
*/
|
|
77
|
+
enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain' | null | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Indicates whether the element is hidden
|
|
80
|
+
*/
|
|
81
|
+
hidden?: boolean | null | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Specifies the primary language for the element's content
|
|
84
|
+
*/
|
|
85
|
+
lang?: string | null | undefined;
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
method?: 'get' | 'post' | 'dialog' | null | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Specifies the name associated with the element. The meaning may vary depending on the context.
|
|
92
|
+
*/
|
|
93
|
+
name?: string | null | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* When present, it specifies that a form should not be validated when submitted.
|
|
96
|
+
*/
|
|
97
|
+
novalidate?: boolean | null | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Represents a slot in a shadow DOM
|
|
100
|
+
*/
|
|
101
|
+
slot?: string | null | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Represents the CSS inline style of the element
|
|
104
|
+
*/
|
|
105
|
+
style?: string | null | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Represents a tab order of the element
|
|
108
|
+
*/
|
|
109
|
+
tabindex?: number | null | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Specifies where to open the linked document.
|
|
112
|
+
*/
|
|
113
|
+
target?: '_self' | '_blank' | '_parent' | '_top' | null | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Represents a title or tooltip for the element
|
|
116
|
+
*/
|
|
117
|
+
title?: string | null | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* used to tell user agents whether the content should be translated.
|
|
120
|
+
*/
|
|
121
|
+
translate?: 'yes' | 'no' | null | undefined;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Form -
|
|
126
|
+
*/
|
|
127
|
+
export class Form {
|
|
128
|
+
private element: HTMLElement;
|
|
129
|
+
|
|
130
|
+
constructor(props: FormProps = {}) {
|
|
131
|
+
this.element = document.createElement('form');
|
|
132
|
+
this.applyProps(props);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
private applyProps(props: FormProps): void {
|
|
136
|
+
if (props.children !== undefined) {
|
|
137
|
+
this.setChildren(props.children);
|
|
138
|
+
}
|
|
139
|
+
if (props['accept-charset'] !== undefined) {
|
|
140
|
+
this.element.setAttribute('accept-charset', String(props['accept-charset']));
|
|
141
|
+
}
|
|
142
|
+
if (props.accesskey !== undefined) {
|
|
143
|
+
this.element.setAttribute('accesskey', String(props.accesskey));
|
|
144
|
+
}
|
|
145
|
+
if (props.action !== undefined) {
|
|
146
|
+
this.element.setAttribute('action', String(props.action));
|
|
147
|
+
}
|
|
148
|
+
if (props['aria-atomic'] !== undefined) {
|
|
149
|
+
this.setAriaAtomic(props['aria-atomic']);
|
|
150
|
+
}
|
|
151
|
+
if (props['aria-details'] !== undefined) {
|
|
152
|
+
this.element.setAttribute('aria-details', String(props['aria-details']));
|
|
153
|
+
}
|
|
154
|
+
if (props['aria-invalid'] !== undefined) {
|
|
155
|
+
this.setAriaInvalid(props['aria-invalid']);
|
|
156
|
+
}
|
|
157
|
+
if (props['aria-keyshortcuts'] !== undefined) {
|
|
158
|
+
this.element.setAttribute('aria-keyshortcuts', String(props['aria-keyshortcuts']));
|
|
159
|
+
}
|
|
160
|
+
if (props['aria-label'] !== undefined) {
|
|
161
|
+
this.element.setAttribute('aria-label', String(props['aria-label']));
|
|
162
|
+
}
|
|
163
|
+
if (props['aria-live'] !== undefined) {
|
|
164
|
+
this.setAriaLive(props['aria-live']);
|
|
165
|
+
}
|
|
166
|
+
if (props['aria-relevant'] !== undefined) {
|
|
167
|
+
this.setAriaRelevant(props['aria-relevant']);
|
|
168
|
+
}
|
|
169
|
+
if (props['aria-roledescription'] !== undefined) {
|
|
170
|
+
this.element.setAttribute('aria-roledescription', String(props['aria-roledescription']));
|
|
171
|
+
}
|
|
172
|
+
if (props.autocomplete !== undefined) {
|
|
173
|
+
this.setAutocomplete(props.autocomplete);
|
|
174
|
+
}
|
|
175
|
+
if (props.autocorrect !== undefined) {
|
|
176
|
+
this.setAutocorrect(props.autocorrect);
|
|
177
|
+
}
|
|
178
|
+
if (props.dir !== undefined) {
|
|
179
|
+
this.setDir(props.dir);
|
|
180
|
+
}
|
|
181
|
+
if (props.draggable !== undefined) {
|
|
182
|
+
this.element.setAttribute('draggable', String(props.draggable));
|
|
183
|
+
}
|
|
184
|
+
if (props.enctype !== undefined) {
|
|
185
|
+
this.setEnctype(props.enctype);
|
|
186
|
+
}
|
|
187
|
+
if (props.hidden !== undefined) {
|
|
188
|
+
this.element.setAttribute('hidden', String(props.hidden));
|
|
189
|
+
}
|
|
190
|
+
if (props.lang !== undefined) {
|
|
191
|
+
this.element.setAttribute('lang', String(props.lang));
|
|
192
|
+
}
|
|
193
|
+
if (props.method !== undefined) {
|
|
194
|
+
this.setMethod(props.method);
|
|
195
|
+
}
|
|
196
|
+
if (props.name !== undefined) {
|
|
197
|
+
this.element.setAttribute('name', String(props.name));
|
|
198
|
+
}
|
|
199
|
+
if (props.novalidate !== undefined) {
|
|
200
|
+
this.element.setAttribute('novalidate', String(props.novalidate));
|
|
201
|
+
}
|
|
202
|
+
if (props.slot !== undefined) {
|
|
203
|
+
this.element.setAttribute('slot', String(props.slot));
|
|
204
|
+
}
|
|
205
|
+
if (props.style !== undefined) {
|
|
206
|
+
this.element.setAttribute('style', String(props.style));
|
|
207
|
+
}
|
|
208
|
+
if (props.tabindex !== undefined) {
|
|
209
|
+
this.element.setAttribute('tabindex', String(props.tabindex));
|
|
210
|
+
}
|
|
211
|
+
if (props.target !== undefined) {
|
|
212
|
+
this.setTarget(props.target);
|
|
213
|
+
}
|
|
214
|
+
if (props.title !== undefined) {
|
|
215
|
+
this.element.setAttribute('title', String(props.title));
|
|
216
|
+
}
|
|
217
|
+
if (props.translate !== undefined) {
|
|
218
|
+
this.setTranslate(props.translate);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
setAcceptCharset(value: string | null | undefined): this {
|
|
223
|
+
if (value === null || value === undefined) {
|
|
224
|
+
this.element.removeAttribute('accept-charset');
|
|
225
|
+
} else {
|
|
226
|
+
this.element.setAttribute('accept-charset', String(value));
|
|
227
|
+
}
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
setAccesskey(value: string | null | undefined): this {
|
|
232
|
+
if (value === null || value === undefined) {
|
|
233
|
+
this.element.removeAttribute('accesskey');
|
|
234
|
+
} else {
|
|
235
|
+
this.element.setAttribute('accesskey', String(value));
|
|
236
|
+
}
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
setAction(value: string | null | undefined): this {
|
|
241
|
+
if (value === null || value === undefined) {
|
|
242
|
+
this.element.removeAttribute('action');
|
|
243
|
+
} else {
|
|
244
|
+
this.element.setAttribute('action', String(value));
|
|
245
|
+
}
|
|
246
|
+
return this;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
setAriaAtomic(value: 'false' | 'true' | boolean | null | undefined): this {
|
|
250
|
+
if (value === null || value === undefined) {
|
|
251
|
+
this.element.removeAttribute('aria-atomic');
|
|
252
|
+
} else {
|
|
253
|
+
this.element.setAttribute('aria-atomic', String(value));
|
|
254
|
+
}
|
|
255
|
+
return this;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
setAriaDetails(value: string | null | undefined): this {
|
|
259
|
+
if (value === null || value === undefined) {
|
|
260
|
+
this.element.removeAttribute('aria-details');
|
|
261
|
+
} else {
|
|
262
|
+
this.element.setAttribute('aria-details', String(value));
|
|
263
|
+
}
|
|
264
|
+
return this;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
setAriaInvalid(value: 'false' | 'true' | 'grammar' | 'spelling' | boolean | null | undefined): this {
|
|
268
|
+
if (value === null || value === undefined) {
|
|
269
|
+
this.element.removeAttribute('aria-invalid');
|
|
270
|
+
} else {
|
|
271
|
+
this.element.setAttribute('aria-invalid', String(value));
|
|
272
|
+
}
|
|
273
|
+
return this;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
setAriaKeyshortcuts(value: string | null | undefined): this {
|
|
277
|
+
if (value === null || value === undefined) {
|
|
278
|
+
this.element.removeAttribute('aria-keyshortcuts');
|
|
279
|
+
} else {
|
|
280
|
+
this.element.setAttribute('aria-keyshortcuts', String(value));
|
|
281
|
+
}
|
|
282
|
+
return this;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
setAriaLabel(value: string | null | undefined): this {
|
|
286
|
+
if (value === null || value === undefined) {
|
|
287
|
+
this.element.removeAttribute('aria-label');
|
|
288
|
+
} else {
|
|
289
|
+
this.element.setAttribute('aria-label', String(value));
|
|
290
|
+
}
|
|
291
|
+
return this;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
setAriaLive(value: 'off' | 'polite' | 'assertive' | null | undefined): this {
|
|
295
|
+
if (value === null || value === undefined) {
|
|
296
|
+
this.element.removeAttribute('aria-live');
|
|
297
|
+
} else {
|
|
298
|
+
this.element.setAttribute('aria-live', String(value));
|
|
299
|
+
}
|
|
300
|
+
return this;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
setAriaRelevant(value: 'additions' | 'removals' | 'text' | 'all' | 'additions text' | null | undefined): this {
|
|
304
|
+
if (value === null || value === undefined) {
|
|
305
|
+
this.element.removeAttribute('aria-relevant');
|
|
306
|
+
} else {
|
|
307
|
+
this.element.setAttribute('aria-relevant', String(value));
|
|
308
|
+
}
|
|
309
|
+
return this;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
setAriaRoledescription(value: string | null | undefined): this {
|
|
313
|
+
if (value === null || value === undefined) {
|
|
314
|
+
this.element.removeAttribute('aria-roledescription');
|
|
315
|
+
} else {
|
|
316
|
+
this.element.setAttribute('aria-roledescription', String(value));
|
|
317
|
+
}
|
|
318
|
+
return this;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
setAutocomplete(value: 'off' | 'on' | null | undefined): this {
|
|
322
|
+
if (value === null || value === undefined) {
|
|
323
|
+
this.element.removeAttribute('autocomplete');
|
|
324
|
+
} else {
|
|
325
|
+
this.element.setAttribute('autocomplete', String(value));
|
|
326
|
+
}
|
|
327
|
+
return this;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
setAutocorrect(value: 'off' | 'on' | null | undefined): this {
|
|
331
|
+
if (value === null || value === undefined) {
|
|
332
|
+
this.element.removeAttribute('autocorrect');
|
|
333
|
+
} else {
|
|
334
|
+
this.element.setAttribute('autocorrect', String(value));
|
|
335
|
+
}
|
|
336
|
+
return this;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
setDir(value: 'ltr' | 'rtl' | 'auto' | null | undefined): this {
|
|
340
|
+
if (value === null || value === undefined) {
|
|
341
|
+
this.element.removeAttribute('dir');
|
|
342
|
+
} else {
|
|
343
|
+
this.element.setAttribute('dir', String(value));
|
|
344
|
+
}
|
|
345
|
+
return this;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
setDraggable(value: boolean | null | undefined): this {
|
|
349
|
+
if (value === true) {
|
|
350
|
+
this.element.setAttribute('draggable', '');
|
|
351
|
+
} else {
|
|
352
|
+
this.element.removeAttribute('draggable');
|
|
353
|
+
}
|
|
354
|
+
return this;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
setEnctype(value: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain' | null | undefined): this {
|
|
358
|
+
if (value === null || value === undefined) {
|
|
359
|
+
this.element.removeAttribute('enctype');
|
|
360
|
+
} else {
|
|
361
|
+
this.element.setAttribute('enctype', String(value));
|
|
362
|
+
}
|
|
363
|
+
return this;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
setHidden(value: boolean | null | undefined): this {
|
|
367
|
+
if (value === true) {
|
|
368
|
+
this.element.setAttribute('hidden', '');
|
|
369
|
+
} else {
|
|
370
|
+
this.element.removeAttribute('hidden');
|
|
371
|
+
}
|
|
372
|
+
return this;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
setLang(value: string | null | undefined): this {
|
|
376
|
+
if (value === null || value === undefined) {
|
|
377
|
+
this.element.removeAttribute('lang');
|
|
378
|
+
} else {
|
|
379
|
+
this.element.setAttribute('lang', String(value));
|
|
380
|
+
}
|
|
381
|
+
return this;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
setMethod(value: 'get' | 'post' | 'dialog' | null | undefined): this {
|
|
385
|
+
if (value === null || value === undefined) {
|
|
386
|
+
this.element.removeAttribute('method');
|
|
387
|
+
} else {
|
|
388
|
+
this.element.setAttribute('method', String(value));
|
|
389
|
+
}
|
|
390
|
+
return this;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
setName(value: string | null | undefined): this {
|
|
394
|
+
if (value === null || value === undefined) {
|
|
395
|
+
this.element.removeAttribute('name');
|
|
396
|
+
} else {
|
|
397
|
+
this.element.setAttribute('name', String(value));
|
|
398
|
+
}
|
|
399
|
+
return this;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
setNovalidate(value: boolean | null | undefined): this {
|
|
403
|
+
if (value === true) {
|
|
404
|
+
this.element.setAttribute('novalidate', '');
|
|
405
|
+
} else {
|
|
406
|
+
this.element.removeAttribute('novalidate');
|
|
407
|
+
}
|
|
408
|
+
return this;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
setSlot(value: string | null | undefined): this {
|
|
412
|
+
if (value === null || value === undefined) {
|
|
413
|
+
this.element.removeAttribute('slot');
|
|
414
|
+
} else {
|
|
415
|
+
this.element.setAttribute('slot', String(value));
|
|
416
|
+
}
|
|
417
|
+
return this;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
setStyle(value: string | null | undefined): this {
|
|
421
|
+
if (value === null || value === undefined) {
|
|
422
|
+
this.element.removeAttribute('style');
|
|
423
|
+
} else {
|
|
424
|
+
this.element.setAttribute('style', String(value));
|
|
425
|
+
}
|
|
426
|
+
return this;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
setTabindex(value: number | null | undefined): this {
|
|
430
|
+
if (value === null || value === undefined) {
|
|
431
|
+
this.element.removeAttribute('tabindex');
|
|
432
|
+
} else {
|
|
433
|
+
this.element.setAttribute('tabindex', String(value));
|
|
434
|
+
}
|
|
435
|
+
return this;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
setTarget(value: '_self' | '_blank' | '_parent' | '_top' | null | undefined): this {
|
|
439
|
+
if (value === null || value === undefined) {
|
|
440
|
+
this.element.removeAttribute('target');
|
|
441
|
+
} else {
|
|
442
|
+
this.element.setAttribute('target', String(value));
|
|
443
|
+
}
|
|
444
|
+
return this;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
setTitle(value: string | null | undefined): this {
|
|
448
|
+
if (value === null || value === undefined) {
|
|
449
|
+
this.element.removeAttribute('title');
|
|
450
|
+
} else {
|
|
451
|
+
this.element.setAttribute('title', String(value));
|
|
452
|
+
}
|
|
453
|
+
return this;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
setTranslate(value: 'yes' | 'no' | null | undefined): this {
|
|
457
|
+
if (value === null || value === undefined) {
|
|
458
|
+
this.element.removeAttribute('translate');
|
|
459
|
+
} else {
|
|
460
|
+
this.element.setAttribute('translate', String(value));
|
|
461
|
+
}
|
|
462
|
+
return this;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
setChildren(children: string | HTMLElement | (string | HTMLElement)[]): this {
|
|
466
|
+
// Clear existing children
|
|
467
|
+
while (this.element.firstChild) {
|
|
468
|
+
this.element.removeChild(this.element.firstChild);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if (typeof children === 'string') {
|
|
472
|
+
this.element.textContent = children;
|
|
473
|
+
} else if (Array.isArray(children)) {
|
|
474
|
+
children.forEach(child => {
|
|
475
|
+
if (typeof child === 'string') {
|
|
476
|
+
this.element.appendChild(document.createTextNode(child));
|
|
477
|
+
} else {
|
|
478
|
+
this.element.appendChild(child);
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
} else {
|
|
482
|
+
this.element.appendChild(children);
|
|
483
|
+
}
|
|
484
|
+
return this;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
getElement(): HTMLElement {
|
|
488
|
+
return this.element;
|
|
489
|
+
}
|
|
490
|
+
}
|