happy-dom 4.1.0 → 5.2.0

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.

Potentially problematic release.


This version of happy-dom might be problematic. Click here for more details.

Files changed (74) hide show
  1. package/lib/config/ElementTag.d.ts +6 -3
  2. package/lib/config/ElementTag.js +6 -3
  3. package/lib/config/ElementTag.js.map +1 -1
  4. package/lib/config/NonImplemenetedElementClasses.js +0 -3
  5. package/lib/config/NonImplemenetedElementClasses.js.map +1 -1
  6. package/lib/dom-token-list/DOMTokenList.d.ts +4 -0
  7. package/lib/dom-token-list/DOMTokenList.js +6 -0
  8. package/lib/dom-token-list/DOMTokenList.js.map +1 -1
  9. package/lib/dom-token-list/IDOMTokenList.d.ts +1 -0
  10. package/lib/nodes/document/Document.js +4 -0
  11. package/lib/nodes/document/Document.js.map +1 -1
  12. package/lib/nodes/element/Element.d.ts +1 -0
  13. package/lib/nodes/element/Element.js.map +1 -1
  14. package/lib/nodes/html-input-element/HTMLInputElement.d.ts +1 -1
  15. package/lib/nodes/html-input-element/HTMLInputElement.js +1 -1
  16. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  17. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +1 -1
  18. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.d.ts +34 -0
  19. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js +58 -0
  20. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js.map +1 -0
  21. package/lib/nodes/html-opt-group-element/IHTMLOptGroupElement.d.ts +11 -0
  22. package/lib/nodes/html-opt-group-element/IHTMLOptGroupElement.js +3 -0
  23. package/lib/nodes/html-opt-group-element/IHTMLOptGroupElement.js.map +1 -0
  24. package/lib/nodes/html-option-element/HTMLOptionElement.d.ts +72 -0
  25. package/lib/nodes/html-option-element/HTMLOptionElement.js +111 -0
  26. package/lib/nodes/html-option-element/HTMLOptionElement.js.map +1 -0
  27. package/lib/nodes/html-option-element/HTMLOptionElementValueSanitizer.d.ts +11 -0
  28. package/lib/nodes/html-option-element/HTMLOptionElementValueSanitizer.js +18 -0
  29. package/lib/nodes/html-option-element/HTMLOptionElementValueSanitizer.js.map +1 -0
  30. package/lib/nodes/html-option-element/HTMLOptionsCollection.d.ts +43 -0
  31. package/lib/nodes/html-option-element/HTMLOptionsCollection.js +80 -0
  32. package/lib/nodes/html-option-element/HTMLOptionsCollection.js.map +1 -0
  33. package/lib/nodes/html-option-element/IHTMLOptionElement.d.ts +16 -0
  34. package/lib/nodes/html-option-element/IHTMLOptionElement.js +3 -0
  35. package/lib/nodes/html-option-element/IHTMLOptionElement.js.map +1 -0
  36. package/lib/nodes/html-option-element/IHTMLOptionsCollection.d.ts +26 -0
  37. package/lib/nodes/html-option-element/IHTMLOptionsCollection.js +3 -0
  38. package/lib/nodes/html-option-element/IHTMLOptionsCollection.js.map +1 -0
  39. package/lib/nodes/html-select-element/HTMLSelectElement.d.ts +128 -0
  40. package/lib/nodes/html-select-element/HTMLSelectElement.js +215 -0
  41. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -0
  42. package/lib/nodes/html-select-element/HTMLSelectElementValueSanitizer.d.ts +11 -0
  43. package/lib/nodes/html-select-element/HTMLSelectElementValueSanitizer.js +18 -0
  44. package/lib/nodes/html-select-element/HTMLSelectElementValueSanitizer.js.map +1 -0
  45. package/lib/nodes/html-select-element/IHTMLSelectElement.d.ts +26 -0
  46. package/lib/nodes/html-select-element/IHTMLSelectElement.js +3 -0
  47. package/lib/nodes/html-select-element/IHTMLSelectElement.js.map +1 -0
  48. package/lib/nodes/{html-input-element → validity-state}/ValidityState.d.ts +3 -2
  49. package/lib/nodes/{html-input-element → validity-state}/ValidityState.js +12 -2
  50. package/lib/nodes/validity-state/ValidityState.js.map +1 -0
  51. package/lib/xml-serializer/XMLSerializer.js +3 -0
  52. package/lib/xml-serializer/XMLSerializer.js.map +1 -1
  53. package/package.json +2 -2
  54. package/src/config/ElementTag.ts +6 -3
  55. package/src/config/NonImplemenetedElementClasses.ts +0 -3
  56. package/src/dom-token-list/DOMTokenList.ts +7 -0
  57. package/src/dom-token-list/IDOMTokenList.ts +1 -0
  58. package/src/nodes/document/Document.ts +3 -0
  59. package/src/nodes/element/Element.ts +1 -0
  60. package/src/nodes/html-input-element/HTMLInputElement.ts +1 -1
  61. package/src/nodes/html-input-element/IHTMLInputElement.ts +1 -1
  62. package/src/nodes/html-opt-group-element/HTMLOptGroupElement.ts +54 -0
  63. package/src/nodes/html-opt-group-element/IHTMLOptGroupElement.ts +12 -0
  64. package/src/nodes/html-option-element/HTMLOptionElement.ts +117 -0
  65. package/src/nodes/html-option-element/HTMLOptionElementValueSanitizer.ts +15 -0
  66. package/src/nodes/html-option-element/HTMLOptionsCollection.ts +94 -0
  67. package/src/nodes/html-option-element/IHTMLOptionElement.ts +17 -0
  68. package/src/nodes/html-option-element/IHTMLOptionsCollection.ts +33 -0
  69. package/src/nodes/html-select-element/HTMLSelectElement.ts +239 -0
  70. package/src/nodes/html-select-element/HTMLSelectElementValueSanitizer.ts +15 -0
  71. package/src/nodes/html-select-element/IHTMLSelectElement.ts +27 -0
  72. package/src/nodes/{html-input-element → validity-state}/ValidityState.ts +13 -5
  73. package/src/xml-serializer/XMLSerializer.ts +5 -0
  74. package/lib/nodes/html-input-element/ValidityState.js.map +0 -1
@@ -0,0 +1,72 @@
1
+ import HTMLElement from '../html-element/HTMLElement';
2
+ import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
3
+ import IHTMLOptionElement from './IHTMLOptionElement';
4
+ /**
5
+ * HTML Option Element.
6
+ *
7
+ * Reference:
8
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement.
9
+ */
10
+ export default class HTMLOptionElement extends HTMLElement implements IHTMLOptionElement {
11
+ _index: number;
12
+ /**
13
+ * Returns inner text, which is the rendered appearance of text.
14
+ *
15
+ * @returns Inner text.
16
+ */
17
+ get text(): string;
18
+ /**
19
+ * Sets the inner text, which is the rendered appearance of text.
20
+ *
21
+ * @param innerText Inner text.
22
+ */
23
+ set text(text: string);
24
+ /**
25
+ * Returns index.
26
+ *
27
+ * @returns Index.
28
+ */
29
+ get index(): number;
30
+ /**
31
+ * Returns the parent form element.
32
+ *
33
+ * @returns Form.
34
+ */
35
+ get form(): IHTMLFormElement;
36
+ /**
37
+ * Returns selected.
38
+ *
39
+ * @returns Selected.
40
+ */
41
+ get selected(): boolean;
42
+ /**
43
+ * Sets selected.
44
+ *
45
+ * @param selected Selected.
46
+ */
47
+ set selected(selected: boolean);
48
+ /**
49
+ * Returns disabled.
50
+ *
51
+ * @returns Disabled.
52
+ */
53
+ get disabled(): boolean;
54
+ /**
55
+ * Sets disabled.
56
+ *
57
+ * @param disabled Disabled.
58
+ */
59
+ set disabled(disabled: boolean);
60
+ /**
61
+ * Returns value.
62
+ *
63
+ * @returns Value.
64
+ */
65
+ get value(): string;
66
+ /**
67
+ * Sets value.
68
+ *
69
+ * @param value Value.
70
+ */
71
+ set value(value: string);
72
+ }
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const HTMLElement_1 = __importDefault(require("../html-element/HTMLElement"));
7
+ const HTMLOptionElementValueSanitizer_1 = __importDefault(require("./HTMLOptionElementValueSanitizer"));
8
+ /**
9
+ * HTML Option Element.
10
+ *
11
+ * Reference:
12
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement.
13
+ */
14
+ class HTMLOptionElement extends HTMLElement_1.default {
15
+ /**
16
+ * Returns inner text, which is the rendered appearance of text.
17
+ *
18
+ * @returns Inner text.
19
+ */
20
+ get text() {
21
+ return this.innerText;
22
+ }
23
+ /**
24
+ * Sets the inner text, which is the rendered appearance of text.
25
+ *
26
+ * @param innerText Inner text.
27
+ */
28
+ set text(text) {
29
+ this.innerText = text;
30
+ }
31
+ /**
32
+ * Returns index.
33
+ *
34
+ * @returns Index.
35
+ */
36
+ get index() {
37
+ return this._index;
38
+ }
39
+ /**
40
+ * Returns the parent form element.
41
+ *
42
+ * @returns Form.
43
+ */
44
+ get form() {
45
+ let parent = this.parentNode;
46
+ while (parent && parent.tagName !== 'FORM') {
47
+ parent = parent.parentNode;
48
+ }
49
+ return parent;
50
+ }
51
+ /**
52
+ * Returns selected.
53
+ *
54
+ * @returns Selected.
55
+ */
56
+ get selected() {
57
+ return this.getAttributeNS(null, 'selected') !== null;
58
+ }
59
+ /**
60
+ * Sets selected.
61
+ *
62
+ * @param selected Selected.
63
+ */
64
+ set selected(selected) {
65
+ if (!selected) {
66
+ this.removeAttributeNS(null, 'selected');
67
+ }
68
+ else {
69
+ this.setAttributeNS(null, 'selected', '');
70
+ }
71
+ }
72
+ /**
73
+ * Returns disabled.
74
+ *
75
+ * @returns Disabled.
76
+ */
77
+ get disabled() {
78
+ return this.getAttributeNS(null, 'disabled') !== null;
79
+ }
80
+ /**
81
+ * Sets disabled.
82
+ *
83
+ * @param disabled Disabled.
84
+ */
85
+ set disabled(disabled) {
86
+ if (!disabled) {
87
+ this.removeAttributeNS(null, 'disabled');
88
+ }
89
+ else {
90
+ this.setAttributeNS(null, 'disabled', '');
91
+ }
92
+ }
93
+ /**
94
+ * Returns value.
95
+ *
96
+ * @returns Value.
97
+ */
98
+ get value() {
99
+ return this.getAttributeNS(null, 'value') || '';
100
+ }
101
+ /**
102
+ * Sets value.
103
+ *
104
+ * @param value Value.
105
+ */
106
+ set value(value) {
107
+ this.setAttributeNS(null, 'value', HTMLOptionElementValueSanitizer_1.default.sanitize(value));
108
+ }
109
+ }
110
+ exports.default = HTMLOptionElement;
111
+ //# sourceMappingURL=HTMLOptionElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HTMLOptionElement.js","sourceRoot":"","sources":["../../../src/nodes/html-option-element/HTMLOptionElement.ts"],"names":[],"mappings":";;;;;AAAA,8EAAsD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AAU,EAAE,EAAE,CAAC,CAAC;SAC1C;IACF,CAAC;IAED;;;;OAIG;IACH,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACH,IAAW,KAAK,CAAC,KAAa;QAC7B,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,yCAA+B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACrF,CAAC;CACD;AAxGD,oCAwGC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * HTML select element value sanitizer.
3
+ */
4
+ export default class HTMLOptionElementValueSanitizer {
5
+ /**
6
+ * Sanitizes a value.
7
+ *
8
+ * @param value Value.
9
+ */
10
+ static sanitize(value: string): string;
11
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const NEW_LINES_REGEXP = /[\n\r]/gm;
4
+ /**
5
+ * HTML select element value sanitizer.
6
+ */
7
+ class HTMLOptionElementValueSanitizer {
8
+ /**
9
+ * Sanitizes a value.
10
+ *
11
+ * @param value Value.
12
+ */
13
+ static sanitize(value) {
14
+ return value.trim().replace(NEW_LINES_REGEXP, '');
15
+ }
16
+ }
17
+ exports.default = HTMLOptionElementValueSanitizer;
18
+ //# sourceMappingURL=HTMLOptionElementValueSanitizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HTMLOptionElementValueSanitizer.js","sourceRoot":"","sources":["../../../src/nodes/html-option-element/HTMLOptionElementValueSanitizer.ts"],"names":[],"mappings":";;AAAA,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAEpC;;GAEG;AACH,MAAqB,+BAA+B;IACnD;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,KAAa;QACnC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;IACnD,CAAC;CACD;AATD,kDASC"}
@@ -0,0 +1,43 @@
1
+ import HTMLCollection from '../element/HTMLCollection';
2
+ import HTMLOptGroupElement from '../html-opt-group-element/HTMLOptGroupElement';
3
+ import HTMLOptionElement from './HTMLOptionElement';
4
+ import IHTMLOptionsCollection from './IHTMLOptionsCollection';
5
+ /**
6
+ * HTML Options Collection.
7
+ *
8
+ * Reference:
9
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionsCollection.
10
+ */
11
+ export default class HTMLOptionsCollection extends HTMLCollection implements IHTMLOptionsCollection {
12
+ _selectedIndex: number;
13
+ /**
14
+ * Returns selectedIndex.
15
+ *
16
+ * @returns SelectedIndex.
17
+ */
18
+ get selectedIndex(): number;
19
+ /**
20
+ * Sets selectedIndex.
21
+ *
22
+ * @param selectedIndex SelectedIndex.
23
+ */
24
+ set selectedIndex(selectedIndex: number);
25
+ /**
26
+ * Returns item by index.
27
+ *
28
+ * @param index Index.
29
+ */
30
+ item(index: number): HTMLOptionElement | HTMLOptGroupElement;
31
+ /**
32
+ *
33
+ * @param element
34
+ * @param before
35
+ */
36
+ add(element: HTMLOptionElement | HTMLOptGroupElement, before?: number | HTMLOptionElement | HTMLOptGroupElement): void;
37
+ /**
38
+ * Removes indexed element from collection.
39
+ *
40
+ * @param index Index.
41
+ */
42
+ remove(index: number): void;
43
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const DOMException_1 = __importDefault(require("../../exception/DOMException"));
7
+ const HTMLCollection_1 = __importDefault(require("../element/HTMLCollection"));
8
+ /**
9
+ * HTML Options Collection.
10
+ *
11
+ * Reference:
12
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionsCollection.
13
+ */
14
+ class HTMLOptionsCollection extends HTMLCollection_1.default {
15
+ /**
16
+ * Returns selectedIndex.
17
+ *
18
+ * @returns SelectedIndex.
19
+ */
20
+ get selectedIndex() {
21
+ return this._selectedIndex;
22
+ }
23
+ /**
24
+ * Sets selectedIndex.
25
+ *
26
+ * @param selectedIndex SelectedIndex.
27
+ */
28
+ set selectedIndex(selectedIndex) {
29
+ this._selectedIndex = selectedIndex;
30
+ }
31
+ /**
32
+ * Returns item by index.
33
+ *
34
+ * @param index Index.
35
+ */
36
+ item(index) {
37
+ return this[index];
38
+ }
39
+ /**
40
+ *
41
+ * @param element
42
+ * @param before
43
+ */
44
+ add(element, before) {
45
+ if (!before && before !== 0) {
46
+ this.push(element);
47
+ return;
48
+ }
49
+ if (!Number.isNaN(Number(before))) {
50
+ if (before < 0) {
51
+ return;
52
+ }
53
+ this.splice(before, 0, element);
54
+ return;
55
+ }
56
+ const idx = this.findIndex((element) => element === before);
57
+ if (idx === -1) {
58
+ throw new DOMException_1.default("Failed to execute 'add' on 'DOMException': The node before which the new node is to be inserted is not a child of this node.");
59
+ }
60
+ this.splice(idx, 0, element);
61
+ }
62
+ /**
63
+ * Removes indexed element from collection.
64
+ *
65
+ * @param index Index.
66
+ */
67
+ remove(index) {
68
+ this.splice(index, 1);
69
+ if (index === this.selectedIndex) {
70
+ if (this.length) {
71
+ this.selectedIndex = 0;
72
+ }
73
+ else {
74
+ this.selectedIndex = -1;
75
+ }
76
+ }
77
+ }
78
+ }
79
+ exports.default = HTMLOptionsCollection;
80
+ //# sourceMappingURL=HTMLOptionsCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HTMLOptionsCollection.js","sourceRoot":"","sources":["../../../src/nodes/html-option-element/HTMLOptionsCollection.ts"],"names":[],"mappings":";;;;;AAAA,gFAAwD;AACxD,+EAAuD;AAKvD;;;;;GAKG;AACH,MAAqB,qBACpB,SAAQ,wBAAc;IAKtB;;;;OAIG;IACH,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAW,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2
+ import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
3
+ /**
4
+ * HTML Option Element.
5
+ *
6
+ * Reference:
7
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement.
8
+ */
9
+ export default interface IHTMLOptionElement extends IHTMLElement {
10
+ readonly form: IHTMLFormElement;
11
+ readonly index: number;
12
+ selected: boolean;
13
+ value: string;
14
+ text: string;
15
+ disabled: boolean;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IHTMLOptionElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHTMLOptionElement.js","sourceRoot":"","sources":["../../../src/nodes/html-option-element/IHTMLOptionElement.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import IHTMLCollection from '../element/IHTMLCollection';
2
+ import IHTMLOptGroupElement from '../html-opt-group-element/IHTMLOptGroupElement';
3
+ import IHTMLOptionElement from './IHTMLOptionElement';
4
+ /**
5
+ * HTML Options Collection.
6
+ *
7
+ * Reference:
8
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionsCollection.
9
+ */
10
+ export default interface IHTMLOptionsCollection extends IHTMLCollection<IHTMLOptionElement | IHTMLOptGroupElement> {
11
+ selectedIndex: number;
12
+ length: number;
13
+ /**
14
+ * Adds new option to collection.
15
+ *
16
+ * @param element HTMLOptionElement or HTMLOptGroupElement to add.
17
+ * @param before HTMLOptionElement or index number.
18
+ */
19
+ add(element: IHTMLOptionElement | IHTMLOptGroupElement, before?: number | IHTMLOptionElement | IHTMLOptGroupElement): void;
20
+ /**
21
+ * Removes option element from the collection.
22
+ *
23
+ * @param index Index.
24
+ */
25
+ remove(index: number): void;
26
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IHTMLOptionsCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHTMLOptionsCollection.js","sourceRoot":"","sources":["../../../src/nodes/html-option-element/IHTMLOptionsCollection.ts"],"names":[],"mappings":""}
@@ -0,0 +1,128 @@
1
+ import HTMLElement from '../html-element/HTMLElement';
2
+ import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
3
+ import ValidityState from '../validity-state/ValidityState';
4
+ import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement';
5
+ import IHTMLOptionsCollection from '../html-option-element/IHTMLOptionsCollection';
6
+ import INodeList from '../node/INodeList';
7
+ import IHTMLSelectElement from './IHTMLSelectElement';
8
+ /**
9
+ * HTML Select Element.
10
+ *
11
+ * Reference:
12
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement.
13
+ */
14
+ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelectElement {
15
+ type: string;
16
+ labels: INodeList<IHTMLLabelElement>;
17
+ _value: any;
18
+ _selectedIndex: number;
19
+ _options: IHTMLOptionsCollection;
20
+ /**
21
+ * Returns name.
22
+ *
23
+ * @returns Name.
24
+ */
25
+ get name(): string;
26
+ /**
27
+ * Sets name.
28
+ *
29
+ * @param name Name.
30
+ */
31
+ set name(name: string);
32
+ /**
33
+ * Returns disabled.
34
+ *
35
+ * @returns Disabled.
36
+ */
37
+ get disabled(): boolean;
38
+ /**
39
+ * Sets disabled.
40
+ *
41
+ * @param disabled Disabled.
42
+ */
43
+ set disabled(disabled: boolean);
44
+ /**
45
+ * Returns multiple.
46
+ *
47
+ * @returns Multiple.
48
+ */
49
+ get multiple(): boolean;
50
+ /**
51
+ * Sets multiple.
52
+ *
53
+ * @param multiple Multiple.
54
+ */
55
+ set multiple(multiple: boolean);
56
+ /**
57
+ * Returns autofocus.
58
+ *
59
+ * @returns Autofocus.
60
+ */
61
+ get autofocus(): boolean;
62
+ /**
63
+ * Sets autofocus.
64
+ *
65
+ * @param autofocus Autofocus.
66
+ */
67
+ set autofocus(autofocus: boolean);
68
+ /**
69
+ * Returns required.
70
+ *
71
+ * @returns Required.
72
+ */
73
+ get required(): boolean;
74
+ /**
75
+ * Sets required.
76
+ *
77
+ * @param required Required.
78
+ */
79
+ set required(required: boolean);
80
+ /**
81
+ * Returns value.
82
+ *
83
+ * @returns Value.
84
+ */
85
+ get value(): string;
86
+ /**
87
+ * Sets value.
88
+ *
89
+ * @param value Value.
90
+ */
91
+ set value(value: string);
92
+ /**
93
+ * Returns value.
94
+ *
95
+ * @returns Value.
96
+ */
97
+ get selectedIndex(): number;
98
+ /**
99
+ * Sets value.
100
+ *
101
+ * @param value Value.
102
+ */
103
+ set selectedIndex(value: number);
104
+ /**
105
+ * Returns the parent form element.
106
+ *
107
+ * @returns Form.
108
+ */
109
+ get form(): IHTMLFormElement;
110
+ /**
111
+ * Returns validity state.
112
+ *
113
+ * @returns Validity state.
114
+ */
115
+ get validity(): ValidityState;
116
+ /**
117
+ * Returns "true" if it will validate.
118
+ *
119
+ * @returns "true" if it will validate.
120
+ */
121
+ get willValidate(): boolean;
122
+ /**
123
+ * Returns options.
124
+ *
125
+ * @returns Options.
126
+ */
127
+ get options(): IHTMLOptionsCollection;
128
+ }