happy-dom 2.55.0 → 3.1.1

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 (284) hide show
  1. package/README.md +26 -6
  2. package/lib/async-task-manager/AsyncTaskManager.js +34 -78
  3. package/lib/async-task-manager/AsyncTaskManager.js.map +1 -1
  4. package/lib/attribute/Attr.js +19 -28
  5. package/lib/attribute/Attr.js.map +1 -1
  6. package/lib/config/ElementTag.js +15 -15
  7. package/lib/config/ElementTag.js.map +1 -1
  8. package/lib/cookie/CookieUtility.js +21 -26
  9. package/lib/cookie/CookieUtility.js.map +1 -1
  10. package/lib/css/CSS.js +12 -18
  11. package/lib/css/CSS.js.map +1 -1
  12. package/lib/css/CSSParser.js +29 -33
  13. package/lib/css/CSSParser.js.map +1 -1
  14. package/lib/css/CSSRule.js +24 -29
  15. package/lib/css/CSSRule.js.map +1 -1
  16. package/lib/css/CSSStyleDeclaration.js +4516 -6005
  17. package/lib/css/CSSStyleDeclaration.js.map +1 -1
  18. package/lib/css/CSSStyleSheet.js +17 -59
  19. package/lib/css/CSSStyleSheet.js.map +1 -1
  20. package/lib/css/CSSUnitValue.js +4 -5
  21. package/lib/css/CSSUnitValue.js.map +1 -1
  22. package/lib/css/MediaList.js +23 -28
  23. package/lib/css/MediaList.js.map +1 -1
  24. package/lib/css/rules/CSSFontFaceRule.js +6 -24
  25. package/lib/css/rules/CSSFontFaceRule.js.map +1 -1
  26. package/lib/css/rules/CSSKeyframeRule.js +14 -36
  27. package/lib/css/rules/CSSKeyframeRule.js.map +1 -1
  28. package/lib/css/rules/CSSKeyframesRule.js +31 -54
  29. package/lib/css/rules/CSSKeyframesRule.js.map +1 -1
  30. package/lib/css/rules/CSSMediaRule.js +29 -56
  31. package/lib/css/rules/CSSMediaRule.js.map +1 -1
  32. package/lib/css/rules/CSSStyleRule.js +16 -38
  33. package/lib/css/rules/CSSStyleRule.js.map +1 -1
  34. package/lib/custom-element/CustomElementRegistry.js +21 -24
  35. package/lib/custom-element/CustomElementRegistry.js.map +1 -1
  36. package/lib/dom-implementation/DOMImplementation.js +12 -13
  37. package/lib/dom-implementation/DOMImplementation.js.map +1 -1
  38. package/lib/dom-parser/DOMParser.js +29 -35
  39. package/lib/dom-parser/DOMParser.js.map +1 -1
  40. package/lib/dom-token-list/DOMTokenList.js +64 -79
  41. package/lib/dom-token-list/DOMTokenList.js.map +1 -1
  42. package/lib/event/DataTransfer.js +4 -5
  43. package/lib/event/DataTransfer.js.map +1 -1
  44. package/lib/event/DataTransferItem.js +7 -8
  45. package/lib/event/DataTransferItem.js.map +1 -1
  46. package/lib/event/DataTransferItemList.js +10 -11
  47. package/lib/event/DataTransferItemList.js.map +1 -1
  48. package/lib/event/Event.js +11 -15
  49. package/lib/event/Event.js.map +1 -1
  50. package/lib/event/EventTarget.js +14 -16
  51. package/lib/event/EventTarget.js.map +1 -1
  52. package/lib/event/IUIEventInit.d.ts +2 -2
  53. package/lib/event/UIEvent.d.ts +2 -2
  54. package/lib/event/UIEvent.js +25 -46
  55. package/lib/event/UIEvent.js.map +1 -1
  56. package/lib/event/events/AnimationEvent.js +11 -29
  57. package/lib/event/events/AnimationEvent.js.map +1 -1
  58. package/lib/event/events/CustomEvent.js +9 -31
  59. package/lib/event/events/CustomEvent.js.map +1 -1
  60. package/lib/event/events/ErrorEvent.js +15 -34
  61. package/lib/event/events/ErrorEvent.js.map +1 -1
  62. package/lib/event/events/FocusEvent.js +7 -26
  63. package/lib/event/events/FocusEvent.js.map +1 -1
  64. package/lib/event/events/InputEvent.js +13 -32
  65. package/lib/event/events/InputEvent.js.map +1 -1
  66. package/lib/event/events/KeyboardEvent.js +27 -46
  67. package/lib/event/events/KeyboardEvent.js.map +1 -1
  68. package/lib/event/events/MouseEvent.js +33 -52
  69. package/lib/event/events/MouseEvent.js.map +1 -1
  70. package/lib/event/events/PointerEvent.js +25 -44
  71. package/lib/event/events/PointerEvent.js.map +1 -1
  72. package/lib/event/events/ProgressEvent.js +11 -30
  73. package/lib/event/events/ProgressEvent.js.map +1 -1
  74. package/lib/event/events/StorageEvent.js +13 -32
  75. package/lib/event/events/StorageEvent.js.map +1 -1
  76. package/lib/event/events/WheelEvent.js +16 -35
  77. package/lib/event/events/WheelEvent.js.map +1 -1
  78. package/lib/exception/DOMException.js +5 -24
  79. package/lib/exception/DOMException.js.map +1 -1
  80. package/lib/fetch/FetchHandler.js +18 -22
  81. package/lib/fetch/FetchHandler.js.map +1 -1
  82. package/lib/fetch/Headers.js +3 -23
  83. package/lib/fetch/Headers.js.map +1 -1
  84. package/lib/fetch/Request.js +61 -81
  85. package/lib/fetch/Request.js.map +1 -1
  86. package/lib/fetch/ResourceFetchHandler.js +18 -67
  87. package/lib/fetch/ResourceFetchHandler.js.map +1 -1
  88. package/lib/fetch/Response.js +61 -81
  89. package/lib/fetch/Response.js.map +1 -1
  90. package/lib/file/Blob.js +29 -78
  91. package/lib/file/Blob.js.map +1 -1
  92. package/lib/file/File.js +9 -27
  93. package/lib/file/File.js.map +1 -1
  94. package/lib/file/FileReader.js +57 -78
  95. package/lib/file/FileReader.js.map +1 -1
  96. package/lib/history/History.js +32 -37
  97. package/lib/history/History.js.map +1 -1
  98. package/lib/index.d.ts +3 -3
  99. package/lib/index.js +69 -69
  100. package/lib/index.js.map +1 -1
  101. package/lib/location/Location.js +11 -28
  102. package/lib/location/Location.js.map +1 -1
  103. package/lib/location/RelativeURL.js +5 -8
  104. package/lib/location/RelativeURL.js.map +1 -1
  105. package/lib/location/URL.js +46 -59
  106. package/lib/location/URL.js.map +1 -1
  107. package/lib/match-media/MediaQueryList.js +28 -54
  108. package/lib/match-media/MediaQueryList.js.map +1 -1
  109. package/lib/mutation-observer/MutationListener.js +3 -4
  110. package/lib/mutation-observer/MutationListener.js.map +1 -1
  111. package/lib/mutation-observer/MutationObserver.js +12 -13
  112. package/lib/mutation-observer/MutationObserver.js.map +1 -1
  113. package/lib/mutation-observer/MutationRecord.js +3 -4
  114. package/lib/mutation-observer/MutationRecord.js.map +1 -1
  115. package/lib/navigator/MimeType.js +5 -6
  116. package/lib/navigator/MimeType.js.map +1 -1
  117. package/lib/navigator/MimeTypeArray.js +10 -11
  118. package/lib/navigator/MimeTypeArray.js.map +1 -1
  119. package/lib/navigator/Navigator.js +7 -8
  120. package/lib/navigator/Navigator.js.map +1 -1
  121. package/lib/navigator/Plugin.js +10 -11
  122. package/lib/navigator/Plugin.js.map +1 -1
  123. package/lib/navigator/PluginArray.js +12 -13
  124. package/lib/navigator/PluginArray.js.map +1 -1
  125. package/lib/nodes/character-data/CharacterData.js +119 -184
  126. package/lib/nodes/character-data/CharacterData.js.map +1 -1
  127. package/lib/nodes/character-data/CharacterDataUtility.js +12 -15
  128. package/lib/nodes/character-data/CharacterDataUtility.js.map +1 -1
  129. package/lib/nodes/child-node/ChildNodeUtility.js +24 -45
  130. package/lib/nodes/child-node/ChildNodeUtility.js.map +1 -1
  131. package/lib/nodes/child-node/NonDocumentChildNodeUtility.js +9 -12
  132. package/lib/nodes/child-node/NonDocumentChildNodeUtility.js.map +1 -1
  133. package/lib/nodes/comment/Comment.js +20 -43
  134. package/lib/nodes/comment/Comment.js.map +1 -1
  135. package/lib/nodes/document/Document.d.ts +3 -3
  136. package/lib/nodes/document/Document.js +334 -461
  137. package/lib/nodes/document/Document.js.map +1 -1
  138. package/lib/nodes/document/DocumentReadyStateManager.js +16 -19
  139. package/lib/nodes/document/DocumentReadyStateManager.js.map +1 -1
  140. package/lib/nodes/document/IDocument.d.ts +2 -2
  141. package/lib/nodes/document-fragment/DocumentFragment.js +93 -153
  142. package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
  143. package/lib/nodes/document-type/DocumentType.js +22 -45
  144. package/lib/nodes/document-type/DocumentType.js.map +1 -1
  145. package/lib/nodes/element/DOMRect.js +3 -4
  146. package/lib/nodes/element/DOMRect.js.map +1 -1
  147. package/lib/nodes/element/Element.js +367 -496
  148. package/lib/nodes/element/Element.js.map +1 -1
  149. package/lib/nodes/element/HTMLCollection.js +4 -24
  150. package/lib/nodes/element/HTMLCollection.js.map +1 -1
  151. package/lib/nodes/element/HTMLCollectionFactory.js +6 -9
  152. package/lib/nodes/element/HTMLCollectionFactory.js.map +1 -1
  153. package/lib/nodes/element/Range.js +89 -114
  154. package/lib/nodes/element/Range.js.map +1 -1
  155. package/lib/nodes/html-base-element/HTMLBaseElement.js +41 -70
  156. package/lib/nodes/html-base-element/HTMLBaseElement.js.map +1 -1
  157. package/lib/nodes/html-document/HTMLDocument.js +3 -23
  158. package/lib/nodes/html-document/HTMLDocument.js.map +1 -1
  159. package/lib/nodes/html-element/DatasetUtility.js +9 -12
  160. package/lib/nodes/html-element/DatasetUtility.js.map +1 -1
  161. package/lib/nodes/html-element/HTMLElement.js +232 -290
  162. package/lib/nodes/html-element/HTMLElement.js.map +1 -1
  163. package/lib/nodes/html-form-element/HTMLFormElement.js +170 -235
  164. package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
  165. package/lib/nodes/html-image-element/HTMLImageElement.js +178 -237
  166. package/lib/nodes/html-image-element/HTMLImageElement.js.map +1 -1
  167. package/lib/nodes/html-image-element/Image.js +7 -27
  168. package/lib/nodes/html-image-element/Image.js.map +1 -1
  169. package/lib/nodes/html-input-element/HTMLInputElement.js +705 -872
  170. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  171. package/lib/nodes/html-input-element/HTMLInputElementValueSanitizer.js +9 -12
  172. package/lib/nodes/html-input-element/HTMLInputElementValueSanitizer.js.map +1 -1
  173. package/lib/nodes/html-input-element/HTMLInputElementValueStepping.js +5 -8
  174. package/lib/nodes/html-input-element/HTMLInputElementValueStepping.js.map +1 -1
  175. package/lib/nodes/html-input-element/ValidityState.js +47 -69
  176. package/lib/nodes/html-input-element/ValidityState.js.map +1 -1
  177. package/lib/nodes/html-label-element/HTMLLabelElement.js +53 -87
  178. package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
  179. package/lib/nodes/html-link-element/HTMLLinkElement.js +197 -252
  180. package/lib/nodes/html-link-element/HTMLLinkElement.js.map +1 -1
  181. package/lib/nodes/html-meta-element/HTMLMetaElement.js +66 -102
  182. package/lib/nodes/html-meta-element/HTMLMetaElement.js.map +1 -1
  183. package/lib/nodes/html-script-element/HTMLScriptElement.js +145 -193
  184. package/lib/nodes/html-script-element/HTMLScriptElement.js.map +1 -1
  185. package/lib/nodes/html-script-element/ScriptUtility.js +58 -112
  186. package/lib/nodes/html-script-element/ScriptUtility.js.map +1 -1
  187. package/lib/nodes/html-slot-element/HTMLSlotElement.js +33 -65
  188. package/lib/nodes/html-slot-element/HTMLSlotElement.js.map +1 -1
  189. package/lib/nodes/html-style-element/HTMLStyleElement.js +75 -109
  190. package/lib/nodes/html-style-element/HTMLStyleElement.js.map +1 -1
  191. package/lib/nodes/html-template-element/HTMLTemplateElement.js +60 -99
  192. package/lib/nodes/html-template-element/HTMLTemplateElement.js.map +1 -1
  193. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js +349 -444
  194. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js.map +1 -1
  195. package/lib/nodes/html-unknown-element/HTMLUnknownElement.js +17 -37
  196. package/lib/nodes/html-unknown-element/HTMLUnknownElement.js.map +1 -1
  197. package/lib/nodes/node/Node.js +193 -260
  198. package/lib/nodes/node/Node.js.map +1 -1
  199. package/lib/nodes/node/NodeList.js +4 -24
  200. package/lib/nodes/node/NodeList.js.map +1 -1
  201. package/lib/nodes/node/NodeListFactory.js +6 -9
  202. package/lib/nodes/node/NodeListFactory.js.map +1 -1
  203. package/lib/nodes/parent-node/ParentNodeUtility.js +43 -78
  204. package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
  205. package/lib/nodes/shadow-root/ShadowRoot.js +53 -83
  206. package/lib/nodes/shadow-root/ShadowRoot.js.map +1 -1
  207. package/lib/nodes/svg-document/SVGDocument.js +3 -23
  208. package/lib/nodes/svg-document/SVGDocument.js.map +1 -1
  209. package/lib/nodes/svg-element/DOMMatrix.js +3 -4
  210. package/lib/nodes/svg-element/DOMMatrix.js.map +1 -1
  211. package/lib/nodes/svg-element/SVGAngle.js +10 -11
  212. package/lib/nodes/svg-element/SVGAngle.js.map +1 -1
  213. package/lib/nodes/svg-element/SVGAnimatedRect.js +4 -5
  214. package/lib/nodes/svg-element/SVGAnimatedRect.js.map +1 -1
  215. package/lib/nodes/svg-element/SVGElement.js +58 -93
  216. package/lib/nodes/svg-element/SVGElement.js.map +1 -1
  217. package/lib/nodes/svg-element/SVGGraphicsElement.js +14 -32
  218. package/lib/nodes/svg-element/SVGGraphicsElement.js.map +1 -1
  219. package/lib/nodes/svg-element/SVGLength.js +16 -17
  220. package/lib/nodes/svg-element/SVGLength.js.map +1 -1
  221. package/lib/nodes/svg-element/SVGNumber.js +3 -4
  222. package/lib/nodes/svg-element/SVGNumber.js.map +1 -1
  223. package/lib/nodes/svg-element/SVGPoint.js +3 -4
  224. package/lib/nodes/svg-element/SVGPoint.js.map +1 -1
  225. package/lib/nodes/svg-element/SVGRect.js +3 -4
  226. package/lib/nodes/svg-element/SVGRect.js.map +1 -1
  227. package/lib/nodes/svg-element/SVGSVGElement.js +187 -248
  228. package/lib/nodes/svg-element/SVGSVGElement.js.map +1 -1
  229. package/lib/nodes/svg-element/SVGTransform.js +16 -17
  230. package/lib/nodes/svg-element/SVGTransform.js.map +1 -1
  231. package/lib/nodes/text/Text.js +20 -43
  232. package/lib/nodes/text/Text.js.map +1 -1
  233. package/lib/nodes/xml-document/XMLDocument.js +3 -23
  234. package/lib/nodes/xml-document/XMLDocument.js.map +1 -1
  235. package/lib/query-selector/QuerySelector.js +36 -44
  236. package/lib/query-selector/QuerySelector.js.map +1 -1
  237. package/lib/query-selector/SelectorItem.js +62 -66
  238. package/lib/query-selector/SelectorItem.js.map +1 -1
  239. package/lib/resize-observer/ResizeObserver.js +8 -11
  240. package/lib/resize-observer/ResizeObserver.js.map +1 -1
  241. package/lib/screen/Screen.js +3 -4
  242. package/lib/screen/Screen.js.map +1 -1
  243. package/lib/selection/Selection.js +29 -30
  244. package/lib/selection/Selection.js.map +1 -1
  245. package/lib/storage/Storage.js +22 -27
  246. package/lib/storage/Storage.js.map +1 -1
  247. package/lib/tree-walker/NodeFilterMask.js +1 -1
  248. package/lib/tree-walker/NodeFilterMask.js.map +1 -1
  249. package/lib/tree-walker/TreeWalker.js +30 -33
  250. package/lib/tree-walker/TreeWalker.js.map +1 -1
  251. package/lib/window/GlobalWindow.d.ts +90 -0
  252. package/lib/window/GlobalWindow.js +98 -0
  253. package/lib/window/GlobalWindow.js.map +1 -0
  254. package/lib/window/IWindow.d.ts +35 -18
  255. package/lib/window/VMGlobalPropertyScript.d.ts +2 -0
  256. package/lib/window/VMGlobalPropertyScript.js +65 -0
  257. package/lib/window/VMGlobalPropertyScript.js.map +1 -0
  258. package/lib/window/Window.d.ts +84 -105
  259. package/lib/window/Window.js +286 -490
  260. package/lib/window/Window.js.map +1 -1
  261. package/lib/xml-parser/XMLParser.js +65 -71
  262. package/lib/xml-parser/XMLParser.js.map +1 -1
  263. package/lib/xml-serializer/XMLSerializer.js +30 -37
  264. package/lib/xml-serializer/XMLSerializer.js.map +1 -1
  265. package/package.json +6 -7
  266. package/src/dom-parser/DOMParser.ts +4 -5
  267. package/src/event/IUIEventInit.ts +2 -2
  268. package/src/event/UIEvent.ts +2 -2
  269. package/src/fetch/FetchHandler.ts +3 -3
  270. package/src/fetch/ResourceFetchHandler.ts +2 -2
  271. package/src/index.ts +3 -3
  272. package/src/nodes/document/Document.ts +4 -4
  273. package/src/nodes/document/IDocument.ts +2 -2
  274. package/src/nodes/html-link-element/HTMLLinkElement.ts +8 -2
  275. package/src/nodes/html-script-element/ScriptUtility.ts +4 -4
  276. package/src/window/GlobalWindow.ts +91 -0
  277. package/src/window/IWindow.ts +31 -12
  278. package/src/window/VMGlobalPropertyScript.ts +62 -0
  279. package/src/window/Window.ts +125 -173
  280. package/tsconfig.json +1 -1
  281. package/lib/window/AsyncWindow.d.ts +0 -10
  282. package/lib/window/AsyncWindow.js +0 -38
  283. package/lib/window/AsyncWindow.js.map +0 -1
  284. package/src/window/AsyncWindow.ts +0 -17
@@ -1,438 +1,349 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
4
  };
20
5
  Object.defineProperty(exports, "__esModule", { value: true });
21
- var Event_1 = __importDefault(require("../../event/Event"));
22
- var DOMException_1 = __importDefault(require("../../exception/DOMException"));
23
- var DOMExceptionNameEnum_1 = __importDefault(require("../../exception/DOMExceptionNameEnum"));
24
- var HTMLElement_1 = __importDefault(require("../html-element/HTMLElement"));
25
- var HTMLInputElementSelectionDirectionEnum_1 = __importDefault(require("../html-input-element/HTMLInputElementSelectionDirectionEnum"));
26
- var HTMLInputElementSelectionModeEnum_1 = __importDefault(require("../html-input-element/HTMLInputElementSelectionModeEnum"));
6
+ const Event_1 = __importDefault(require("../../event/Event"));
7
+ const DOMException_1 = __importDefault(require("../../exception/DOMException"));
8
+ const DOMExceptionNameEnum_1 = __importDefault(require("../../exception/DOMExceptionNameEnum"));
9
+ const HTMLElement_1 = __importDefault(require("../html-element/HTMLElement"));
10
+ const HTMLInputElementSelectionDirectionEnum_1 = __importDefault(require("../html-input-element/HTMLInputElementSelectionDirectionEnum"));
11
+ const HTMLInputElementSelectionModeEnum_1 = __importDefault(require("../html-input-element/HTMLInputElementSelectionModeEnum"));
27
12
  /**
28
13
  * HTML Text Area Element.
29
14
  *
30
15
  * Reference:
31
16
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement.
32
17
  */
33
- var HTMLTextAreaElement = /** @class */ (function (_super) {
34
- __extends(HTMLTextAreaElement, _super);
35
- function HTMLTextAreaElement() {
36
- var _this = _super !== null && _super.apply(this, arguments) || this;
37
- _this.type = 'textarea';
38
- _this._value = null;
39
- _this._selectionStart = null;
40
- _this._selectionEnd = null;
41
- _this._selectionDirection = HTMLInputElementSelectionDirectionEnum_1.default.none;
42
- _this.defaultValue = '';
43
- return _this;
44
- }
45
- Object.defineProperty(HTMLTextAreaElement.prototype, "minLength", {
46
- /**
47
- * Returns minlength.
48
- *
49
- * @returns Min length.
50
- */
51
- get: function () {
52
- var minLength = this.getAttributeNS(null, 'minlength');
53
- if (minLength !== null) {
54
- return parseInt(minLength);
55
- }
56
- return -1;
57
- },
58
- /**
59
- * Sets minlength.
60
- *
61
- * @param minLength Min length.
62
- */
63
- set: function (minlength) {
64
- this.setAttributeNS(null, 'minlength', String(minlength));
65
- },
66
- enumerable: false,
67
- configurable: true
68
- });
69
- Object.defineProperty(HTMLTextAreaElement.prototype, "maxLength", {
70
- /**
71
- * Returns maxlength.
72
- *
73
- * @returns Max length.
74
- */
75
- get: function () {
76
- var maxLength = this.getAttributeNS(null, 'maxlength');
77
- if (maxLength !== null) {
78
- return parseInt(maxLength);
79
- }
80
- return -1;
81
- },
82
- /**
83
- * Sets maxlength.
84
- *
85
- * @param maxlength Max length.
86
- */
87
- set: function (maxLength) {
88
- this.setAttributeNS(null, 'maxlength', String(maxLength));
89
- },
90
- enumerable: false,
91
- configurable: true
92
- });
93
- Object.defineProperty(HTMLTextAreaElement.prototype, "name", {
94
- /**
95
- * Returns name.
96
- *
97
- * @returns Name.
98
- */
99
- get: function () {
100
- return this.getAttributeNS(null, 'name') || '';
101
- },
102
- /**
103
- * Sets name.
104
- *
105
- * @param name Name.
106
- */
107
- set: function (name) {
108
- this.setAttributeNS(null, 'name', name);
109
- },
110
- enumerable: false,
111
- configurable: true
112
- });
113
- Object.defineProperty(HTMLTextAreaElement.prototype, "placeholder", {
114
- /**
115
- * Returns placeholder.
116
- *
117
- * @returns Placeholder.
118
- */
119
- get: function () {
120
- return this.getAttributeNS(null, 'placeholder') || '';
121
- },
122
- /**
123
- * Sets placeholder.
124
- *
125
- * @param placeholder Placeholder.
126
- */
127
- set: function (placeholder) {
128
- this.setAttributeNS(null, 'placeholder', placeholder);
129
- },
130
- enumerable: false,
131
- configurable: true
132
- });
133
- Object.defineProperty(HTMLTextAreaElement.prototype, "inputmode", {
134
- /**
135
- * Returns inputmode.
136
- *
137
- * @returns Inputmode.
138
- */
139
- get: function () {
140
- return this.getAttributeNS(null, 'inputmode') || '';
141
- },
142
- /**
143
- * Sets inputmode.
144
- *
145
- * @param inputmode Inputmode.
146
- */
147
- set: function (inputmode) {
148
- this.setAttributeNS(null, 'inputmode', inputmode);
149
- },
150
- enumerable: false,
151
- configurable: true
152
- });
153
- Object.defineProperty(HTMLTextAreaElement.prototype, "cols", {
154
- /**
155
- * Returns cols.
156
- *
157
- * @returns Cols.
158
- */
159
- get: function () {
160
- return this.getAttributeNS(null, 'cols') || '';
161
- },
162
- /**
163
- * Sets cols.
164
- *
165
- * @param cols Cols.
166
- */
167
- set: function (cols) {
168
- this.setAttributeNS(null, 'cols', cols);
169
- },
170
- enumerable: false,
171
- configurable: true
172
- });
173
- Object.defineProperty(HTMLTextAreaElement.prototype, "rows", {
174
- /**
175
- * Returns rows.
176
- *
177
- * @returns Rows.
178
- */
179
- get: function () {
180
- return this.getAttributeNS(null, 'rows') || '';
181
- },
182
- /**
183
- * Sets rows.
184
- *
185
- * @param rows Rows.
186
- */
187
- set: function (rows) {
188
- this.setAttributeNS(null, 'rows', rows);
189
- },
190
- enumerable: false,
191
- configurable: true
192
- });
193
- Object.defineProperty(HTMLTextAreaElement.prototype, "autocomplete", {
194
- /**
195
- * Returns autocomplete.
196
- *
197
- * @returns Autocomplete.
198
- */
199
- get: function () {
200
- return this.getAttributeNS(null, 'autocomplete') || '';
201
- },
202
- /**
203
- * Sets autocomplete.
204
- *
205
- * @param autocomplete Autocomplete.
206
- */
207
- set: function (autocomplete) {
208
- this.setAttributeNS(null, 'autocomplete', autocomplete);
209
- },
210
- enumerable: false,
211
- configurable: true
212
- });
213
- Object.defineProperty(HTMLTextAreaElement.prototype, "readOnly", {
214
- /**
215
- * Returns readOnly.
216
- *
217
- * @returns ReadOnly.
218
- */
219
- get: function () {
220
- return this.getAttributeNS(null, 'readonly') !== null;
221
- },
222
- /**
223
- * Sets readOnly.
224
- *
225
- * @param readOnly ReadOnly.
226
- */
227
- set: function (readOnly) {
228
- if (!readOnly) {
229
- this.removeAttributeNS(null, 'readonly');
230
- }
231
- else {
232
- this.setAttributeNS(null, 'readonly', '');
233
- }
234
- },
235
- enumerable: false,
236
- configurable: true
237
- });
238
- Object.defineProperty(HTMLTextAreaElement.prototype, "disabled", {
239
- /**
240
- * Returns disabled.
241
- *
242
- * @returns Disabled.
243
- */
244
- get: function () {
245
- return this.getAttributeNS(null, 'disabled') !== null;
246
- },
247
- /**
248
- * Sets disabled.
249
- *
250
- * @param disabled Disabled.
251
- */
252
- set: function (disabled) {
253
- if (!disabled) {
254
- this.removeAttributeNS(null, 'disabled');
255
- }
256
- else {
257
- this.setAttributeNS(null, 'disabled', '');
258
- }
259
- },
260
- enumerable: false,
261
- configurable: true
262
- });
263
- Object.defineProperty(HTMLTextAreaElement.prototype, "autofocus", {
264
- /**
265
- * Returns autofocus.
266
- *
267
- * @returns Autofocus.
268
- */
269
- get: function () {
270
- return this.getAttributeNS(null, 'autofocus') !== null;
271
- },
272
- /**
273
- * Sets autofocus.
274
- *
275
- * @param autofocus Autofocus.
276
- */
277
- set: function (autofocus) {
278
- if (!autofocus) {
279
- this.removeAttributeNS(null, 'autofocus');
280
- }
281
- else {
282
- this.setAttributeNS(null, 'autofocus', '');
283
- }
284
- },
285
- enumerable: false,
286
- configurable: true
287
- });
288
- Object.defineProperty(HTMLTextAreaElement.prototype, "required", {
289
- /**
290
- * Returns required.
291
- *
292
- * @returns Required.
293
- */
294
- get: function () {
295
- return this.getAttributeNS(null, 'required') !== null;
296
- },
297
- /**
298
- * Sets required.
299
- *
300
- * @param required Required.
301
- */
302
- set: function (required) {
303
- if (!required) {
304
- this.removeAttributeNS(null, 'required');
305
- }
306
- else {
307
- this.setAttributeNS(null, 'required', '');
308
- }
309
- },
310
- enumerable: false,
311
- configurable: true
312
- });
313
- Object.defineProperty(HTMLTextAreaElement.prototype, "value", {
314
- /**
315
- * Returns value.
316
- *
317
- * @returns Value.
318
- */
319
- get: function () {
320
- if (this._value === null) {
321
- return this.getAttributeNS(null, 'value') || '';
322
- }
323
- return this._value;
324
- },
325
- /**
326
- * Sets value.
327
- *
328
- * @param value Value.
329
- */
330
- set: function (value) {
331
- var oldValue = this._value;
332
- this._value = value;
333
- if (oldValue !== this._value) {
334
- this._selectionStart = this._value.length;
335
- this._selectionEnd = this._value.length;
336
- this._selectionDirection = HTMLInputElementSelectionDirectionEnum_1.default.none;
337
- }
338
- },
339
- enumerable: false,
340
- configurable: true
341
- });
342
- Object.defineProperty(HTMLTextAreaElement.prototype, "selectionStart", {
343
- /**
344
- * Returns selection start.
345
- *
346
- * @returns Selection start.
347
- */
348
- get: function () {
349
- if (this._selectionStart === null) {
350
- return this.value.length;
351
- }
352
- return this._selectionStart;
353
- },
354
- /**
355
- * Sets selection start.
356
- *
357
- * @param start Start.
358
- */
359
- set: function (start) {
360
- this.setSelectionRange(start, Math.max(start, this.selectionEnd), this._selectionDirection);
361
- },
362
- enumerable: false,
363
- configurable: true
364
- });
365
- Object.defineProperty(HTMLTextAreaElement.prototype, "selectionEnd", {
366
- /**
367
- * Returns selection end.
368
- *
369
- * @returns Selection end.
370
- */
371
- get: function () {
372
- if (this._selectionEnd === null) {
373
- return this.value.length;
374
- }
375
- return this._selectionEnd;
376
- },
377
- /**
378
- * Sets selection end.
379
- *
380
- * @param end End.
381
- */
382
- set: function (end) {
383
- this.setSelectionRange(this.selectionStart, end, this._selectionDirection);
384
- },
385
- enumerable: false,
386
- configurable: true
387
- });
388
- Object.defineProperty(HTMLTextAreaElement.prototype, "selectionDirection", {
389
- /**
390
- * Returns selection direction.
391
- *
392
- * @returns Selection direction.
393
- */
394
- get: function () {
395
- return this._selectionDirection;
396
- },
397
- /**
398
- * Sets selection direction.
399
- *
400
- * @param direction Direction.
401
- */
402
- set: function (direction) {
403
- this.setSelectionRange(this._selectionStart, this._selectionEnd, direction);
404
- },
405
- enumerable: false,
406
- configurable: true
407
- });
408
- Object.defineProperty(HTMLTextAreaElement.prototype, "form", {
409
- /**
410
- * Returns the parent form element.
411
- *
412
- * @returns Form.
413
- */
414
- get: function () {
415
- var parent = this.parentNode;
416
- while (parent && parent.tagName !== 'FORM') {
417
- parent = parent.parentNode;
418
- }
419
- return parent;
420
- },
421
- enumerable: false,
422
- configurable: true
423
- });
424
- Object.defineProperty(HTMLTextAreaElement.prototype, "textLength", {
425
- /**
426
- * Returns text length.
427
- *
428
- * @param Text Length.
429
- */
430
- get: function () {
18
+ class HTMLTextAreaElement extends HTMLElement_1.default {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.type = 'textarea';
22
+ this._value = null;
23
+ this._selectionStart = null;
24
+ this._selectionEnd = null;
25
+ this._selectionDirection = HTMLInputElementSelectionDirectionEnum_1.default.none;
26
+ this.defaultValue = '';
27
+ }
28
+ /**
29
+ * Returns minlength.
30
+ *
31
+ * @returns Min length.
32
+ */
33
+ get minLength() {
34
+ const minLength = this.getAttributeNS(null, 'minlength');
35
+ if (minLength !== null) {
36
+ return parseInt(minLength);
37
+ }
38
+ return -1;
39
+ }
40
+ /**
41
+ * Sets minlength.
42
+ *
43
+ * @param minLength Min length.
44
+ */
45
+ set minLength(minlength) {
46
+ this.setAttributeNS(null, 'minlength', String(minlength));
47
+ }
48
+ /**
49
+ * Returns maxlength.
50
+ *
51
+ * @returns Max length.
52
+ */
53
+ get maxLength() {
54
+ const maxLength = this.getAttributeNS(null, 'maxlength');
55
+ if (maxLength !== null) {
56
+ return parseInt(maxLength);
57
+ }
58
+ return -1;
59
+ }
60
+ /**
61
+ * Sets maxlength.
62
+ *
63
+ * @param maxlength Max length.
64
+ */
65
+ set maxLength(maxLength) {
66
+ this.setAttributeNS(null, 'maxlength', String(maxLength));
67
+ }
68
+ /**
69
+ * Returns name.
70
+ *
71
+ * @returns Name.
72
+ */
73
+ get name() {
74
+ return this.getAttributeNS(null, 'name') || '';
75
+ }
76
+ /**
77
+ * Sets name.
78
+ *
79
+ * @param name Name.
80
+ */
81
+ set name(name) {
82
+ this.setAttributeNS(null, 'name', name);
83
+ }
84
+ /**
85
+ * Returns placeholder.
86
+ *
87
+ * @returns Placeholder.
88
+ */
89
+ get placeholder() {
90
+ return this.getAttributeNS(null, 'placeholder') || '';
91
+ }
92
+ /**
93
+ * Sets placeholder.
94
+ *
95
+ * @param placeholder Placeholder.
96
+ */
97
+ set placeholder(placeholder) {
98
+ this.setAttributeNS(null, 'placeholder', placeholder);
99
+ }
100
+ /**
101
+ * Returns inputmode.
102
+ *
103
+ * @returns Inputmode.
104
+ */
105
+ get inputmode() {
106
+ return this.getAttributeNS(null, 'inputmode') || '';
107
+ }
108
+ /**
109
+ * Sets inputmode.
110
+ *
111
+ * @param inputmode Inputmode.
112
+ */
113
+ set inputmode(inputmode) {
114
+ this.setAttributeNS(null, 'inputmode', inputmode);
115
+ }
116
+ /**
117
+ * Returns cols.
118
+ *
119
+ * @returns Cols.
120
+ */
121
+ get cols() {
122
+ return this.getAttributeNS(null, 'cols') || '';
123
+ }
124
+ /**
125
+ * Sets cols.
126
+ *
127
+ * @param cols Cols.
128
+ */
129
+ set cols(cols) {
130
+ this.setAttributeNS(null, 'cols', cols);
131
+ }
132
+ /**
133
+ * Returns rows.
134
+ *
135
+ * @returns Rows.
136
+ */
137
+ get rows() {
138
+ return this.getAttributeNS(null, 'rows') || '';
139
+ }
140
+ /**
141
+ * Sets rows.
142
+ *
143
+ * @param rows Rows.
144
+ */
145
+ set rows(rows) {
146
+ this.setAttributeNS(null, 'rows', rows);
147
+ }
148
+ /**
149
+ * Returns autocomplete.
150
+ *
151
+ * @returns Autocomplete.
152
+ */
153
+ get autocomplete() {
154
+ return this.getAttributeNS(null, 'autocomplete') || '';
155
+ }
156
+ /**
157
+ * Sets autocomplete.
158
+ *
159
+ * @param autocomplete Autocomplete.
160
+ */
161
+ set autocomplete(autocomplete) {
162
+ this.setAttributeNS(null, 'autocomplete', autocomplete);
163
+ }
164
+ /**
165
+ * Returns readOnly.
166
+ *
167
+ * @returns ReadOnly.
168
+ */
169
+ get readOnly() {
170
+ return this.getAttributeNS(null, 'readonly') !== null;
171
+ }
172
+ /**
173
+ * Sets readOnly.
174
+ *
175
+ * @param readOnly ReadOnly.
176
+ */
177
+ set readOnly(readOnly) {
178
+ if (!readOnly) {
179
+ this.removeAttributeNS(null, 'readonly');
180
+ }
181
+ else {
182
+ this.setAttributeNS(null, 'readonly', '');
183
+ }
184
+ }
185
+ /**
186
+ * Returns disabled.
187
+ *
188
+ * @returns Disabled.
189
+ */
190
+ get disabled() {
191
+ return this.getAttributeNS(null, 'disabled') !== null;
192
+ }
193
+ /**
194
+ * Sets disabled.
195
+ *
196
+ * @param disabled Disabled.
197
+ */
198
+ set disabled(disabled) {
199
+ if (!disabled) {
200
+ this.removeAttributeNS(null, 'disabled');
201
+ }
202
+ else {
203
+ this.setAttributeNS(null, 'disabled', '');
204
+ }
205
+ }
206
+ /**
207
+ * Returns autofocus.
208
+ *
209
+ * @returns Autofocus.
210
+ */
211
+ get autofocus() {
212
+ return this.getAttributeNS(null, 'autofocus') !== null;
213
+ }
214
+ /**
215
+ * Sets autofocus.
216
+ *
217
+ * @param autofocus Autofocus.
218
+ */
219
+ set autofocus(autofocus) {
220
+ if (!autofocus) {
221
+ this.removeAttributeNS(null, 'autofocus');
222
+ }
223
+ else {
224
+ this.setAttributeNS(null, 'autofocus', '');
225
+ }
226
+ }
227
+ /**
228
+ * Returns required.
229
+ *
230
+ * @returns Required.
231
+ */
232
+ get required() {
233
+ return this.getAttributeNS(null, 'required') !== null;
234
+ }
235
+ /**
236
+ * Sets required.
237
+ *
238
+ * @param required Required.
239
+ */
240
+ set required(required) {
241
+ if (!required) {
242
+ this.removeAttributeNS(null, 'required');
243
+ }
244
+ else {
245
+ this.setAttributeNS(null, 'required', '');
246
+ }
247
+ }
248
+ /**
249
+ * Returns value.
250
+ *
251
+ * @returns Value.
252
+ */
253
+ get value() {
254
+ if (this._value === null) {
255
+ return this.getAttributeNS(null, 'value') || '';
256
+ }
257
+ return this._value;
258
+ }
259
+ /**
260
+ * Sets value.
261
+ *
262
+ * @param value Value.
263
+ */
264
+ set value(value) {
265
+ const oldValue = this._value;
266
+ this._value = value;
267
+ if (oldValue !== this._value) {
268
+ this._selectionStart = this._value.length;
269
+ this._selectionEnd = this._value.length;
270
+ this._selectionDirection = HTMLInputElementSelectionDirectionEnum_1.default.none;
271
+ }
272
+ }
273
+ /**
274
+ * Returns selection start.
275
+ *
276
+ * @returns Selection start.
277
+ */
278
+ get selectionStart() {
279
+ if (this._selectionStart === null) {
431
280
  return this.value.length;
432
- },
433
- enumerable: false,
434
- configurable: true
435
- });
281
+ }
282
+ return this._selectionStart;
283
+ }
284
+ /**
285
+ * Sets selection start.
286
+ *
287
+ * @param start Start.
288
+ */
289
+ set selectionStart(start) {
290
+ this.setSelectionRange(start, Math.max(start, this.selectionEnd), this._selectionDirection);
291
+ }
292
+ /**
293
+ * Returns selection end.
294
+ *
295
+ * @returns Selection end.
296
+ */
297
+ get selectionEnd() {
298
+ if (this._selectionEnd === null) {
299
+ return this.value.length;
300
+ }
301
+ return this._selectionEnd;
302
+ }
303
+ /**
304
+ * Sets selection end.
305
+ *
306
+ * @param end End.
307
+ */
308
+ set selectionEnd(end) {
309
+ this.setSelectionRange(this.selectionStart, end, this._selectionDirection);
310
+ }
311
+ /**
312
+ * Returns selection direction.
313
+ *
314
+ * @returns Selection direction.
315
+ */
316
+ get selectionDirection() {
317
+ return this._selectionDirection;
318
+ }
319
+ /**
320
+ * Sets selection direction.
321
+ *
322
+ * @param direction Direction.
323
+ */
324
+ set selectionDirection(direction) {
325
+ this.setSelectionRange(this._selectionStart, this._selectionEnd, direction);
326
+ }
327
+ /**
328
+ * Returns the parent form element.
329
+ *
330
+ * @returns Form.
331
+ */
332
+ get form() {
333
+ let parent = this.parentNode;
334
+ while (parent && parent.tagName !== 'FORM') {
335
+ parent = parent.parentNode;
336
+ }
337
+ return parent;
338
+ }
339
+ /**
340
+ * Returns text length.
341
+ *
342
+ * @param Text Length.
343
+ */
344
+ get textLength() {
345
+ return this.value.length;
346
+ }
436
347
  /**
437
348
  * Set selection range.
438
349
  *
@@ -440,8 +351,7 @@ var HTMLTextAreaElement = /** @class */ (function (_super) {
440
351
  * @param end End.
441
352
  * @param [direction="none"] Direction.
442
353
  */
443
- HTMLTextAreaElement.prototype.setSelectionRange = function (start, end, direction) {
444
- if (direction === void 0) { direction = 'none'; }
354
+ setSelectionRange(start, end, direction = 'none') {
445
355
  this._selectionEnd = Math.min(end, this.value.length);
446
356
  this._selectionStart = Math.min(start, this._selectionEnd);
447
357
  this._selectionDirection =
@@ -450,7 +360,7 @@ var HTMLTextAreaElement = /** @class */ (function (_super) {
450
360
  ? direction
451
361
  : HTMLInputElementSelectionDirectionEnum_1.default.none;
452
362
  this.dispatchEvent(new Event_1.default('select', { bubbles: true, cancelable: true }));
453
- };
363
+ }
454
364
  /**
455
365
  * Set range text.
456
366
  *
@@ -460,10 +370,7 @@ var HTMLTextAreaElement = /** @class */ (function (_super) {
460
370
  * @param [direction] Direction.
461
371
  * @param selectionMode
462
372
  */
463
- HTMLTextAreaElement.prototype.setRangeText = function (replacement, start, end, selectionMode) {
464
- if (start === void 0) { start = null; }
465
- if (end === void 0) { end = null; }
466
- if (selectionMode === void 0) { selectionMode = HTMLInputElementSelectionModeEnum_1.default.preserve; }
373
+ setRangeText(replacement, start = null, end = null, selectionMode = HTMLInputElementSelectionModeEnum_1.default.preserve) {
467
374
  if (start === null) {
468
375
  start = this._selectionStart;
469
376
  }
@@ -475,11 +382,11 @@ var HTMLTextAreaElement = /** @class */ (function (_super) {
475
382
  }
476
383
  start = Math.min(start, this.value.length);
477
384
  end = Math.min(end, this.value.length);
478
- var val = this.value;
479
- var selectionStart = this._selectionStart;
480
- var selectionEnd = this._selectionEnd;
385
+ const val = this.value;
386
+ let selectionStart = this._selectionStart;
387
+ let selectionEnd = this._selectionEnd;
481
388
  this.value = val.slice(0, start) + replacement + val.slice(end);
482
- var newEnd = start + this.value.length;
389
+ const newEnd = start + this.value.length;
483
390
  switch (selectionMode) {
484
391
  case HTMLInputElementSelectionModeEnum_1.default.select:
485
392
  this.setSelectionRange(start, newEnd);
@@ -491,7 +398,7 @@ var HTMLTextAreaElement = /** @class */ (function (_super) {
491
398
  this.setSelectionRange(newEnd, newEnd);
492
399
  break;
493
400
  default:
494
- var delta = replacement.length - (end - start);
401
+ const delta = replacement.length - (end - start);
495
402
  if (selectionStart > end) {
496
403
  selectionStart += delta;
497
404
  }
@@ -507,15 +414,15 @@ var HTMLTextAreaElement = /** @class */ (function (_super) {
507
414
  this.setSelectionRange(selectionStart, selectionEnd);
508
415
  break;
509
416
  }
510
- };
417
+ }
511
418
  /**
512
419
  * Checks validity.
513
420
  *
514
421
  * @returns "true" if validation does'nt fail.
515
422
  */
516
- HTMLTextAreaElement.prototype.checkValidity = function () {
423
+ checkValidity() {
517
424
  return true;
518
- };
425
+ }
519
426
  /**
520
427
  * Clones a node.
521
428
  *
@@ -523,17 +430,15 @@ var HTMLTextAreaElement = /** @class */ (function (_super) {
523
430
  * @param [deep=false] "true" to clone deep.
524
431
  * @returns Cloned node.
525
432
  */
526
- HTMLTextAreaElement.prototype.cloneNode = function (deep) {
527
- if (deep === void 0) { deep = false; }
528
- var clone = _super.prototype.cloneNode.call(this, deep);
433
+ cloneNode(deep = false) {
434
+ const clone = super.cloneNode(deep);
529
435
  clone._value = this._value;
530
436
  clone._selectionStart = this._selectionStart;
531
437
  clone._selectionEnd = this._selectionEnd;
532
438
  clone._selectionDirection = this._selectionDirection;
533
439
  clone.defaultValue = this.defaultValue;
534
440
  return clone;
535
- };
536
- return HTMLTextAreaElement;
537
- }(HTMLElement_1.default));
441
+ }
442
+ }
538
443
  exports.default = HTMLTextAreaElement;
539
444
  //# sourceMappingURL=HTMLTextAreaElement.js.map