happy-dom 5.0.0 → 5.1.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 (59) 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/nodes/html-input-element/HTMLInputElement.d.ts +1 -1
  7. package/lib/nodes/html-input-element/HTMLInputElement.js +1 -1
  8. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  9. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +1 -1
  10. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.d.ts +34 -0
  11. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js +58 -0
  12. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js.map +1 -0
  13. package/lib/nodes/html-opt-group-element/IHTMLOptGroupElement.d.ts +11 -0
  14. package/lib/nodes/html-opt-group-element/IHTMLOptGroupElement.js +3 -0
  15. package/lib/nodes/html-opt-group-element/IHTMLOptGroupElement.js.map +1 -0
  16. package/lib/nodes/html-option-element/HTMLOptionElement.d.ts +72 -0
  17. package/lib/nodes/html-option-element/HTMLOptionElement.js +111 -0
  18. package/lib/nodes/html-option-element/HTMLOptionElement.js.map +1 -0
  19. package/lib/nodes/html-option-element/HTMLOptionElementValueSanitizer.d.ts +11 -0
  20. package/lib/nodes/html-option-element/HTMLOptionElementValueSanitizer.js +18 -0
  21. package/lib/nodes/html-option-element/HTMLOptionElementValueSanitizer.js.map +1 -0
  22. package/lib/nodes/html-option-element/HTMLOptionsCollection.d.ts +43 -0
  23. package/lib/nodes/html-option-element/HTMLOptionsCollection.js +80 -0
  24. package/lib/nodes/html-option-element/HTMLOptionsCollection.js.map +1 -0
  25. package/lib/nodes/html-option-element/IHTMLOptionElement.d.ts +16 -0
  26. package/lib/nodes/html-option-element/IHTMLOptionElement.js +3 -0
  27. package/lib/nodes/html-option-element/IHTMLOptionElement.js.map +1 -0
  28. package/lib/nodes/html-option-element/IHTMLOptionsCollection.d.ts +26 -0
  29. package/lib/nodes/html-option-element/IHTMLOptionsCollection.js +3 -0
  30. package/lib/nodes/html-option-element/IHTMLOptionsCollection.js.map +1 -0
  31. package/lib/nodes/html-select-element/HTMLSelectElement.d.ts +128 -0
  32. package/lib/nodes/html-select-element/HTMLSelectElement.js +215 -0
  33. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -0
  34. package/lib/nodes/html-select-element/HTMLSelectElementValueSanitizer.d.ts +11 -0
  35. package/lib/nodes/html-select-element/HTMLSelectElementValueSanitizer.js +18 -0
  36. package/lib/nodes/html-select-element/HTMLSelectElementValueSanitizer.js.map +1 -0
  37. package/lib/nodes/html-select-element/IHTMLSelectElement.d.ts +26 -0
  38. package/lib/nodes/html-select-element/IHTMLSelectElement.js +3 -0
  39. package/lib/nodes/html-select-element/IHTMLSelectElement.js.map +1 -0
  40. package/lib/nodes/{html-input-element → validity-state}/ValidityState.d.ts +3 -2
  41. package/lib/nodes/{html-input-element → validity-state}/ValidityState.js +12 -2
  42. package/lib/nodes/validity-state/ValidityState.js.map +1 -0
  43. package/package.json +2 -2
  44. package/src/config/ElementTag.ts +6 -3
  45. package/src/config/NonImplemenetedElementClasses.ts +0 -3
  46. package/src/nodes/html-input-element/HTMLInputElement.ts +1 -1
  47. package/src/nodes/html-input-element/IHTMLInputElement.ts +1 -1
  48. package/src/nodes/html-opt-group-element/HTMLOptGroupElement.ts +54 -0
  49. package/src/nodes/html-opt-group-element/IHTMLOptGroupElement.ts +12 -0
  50. package/src/nodes/html-option-element/HTMLOptionElement.ts +117 -0
  51. package/src/nodes/html-option-element/HTMLOptionElementValueSanitizer.ts +15 -0
  52. package/src/nodes/html-option-element/HTMLOptionsCollection.ts +94 -0
  53. package/src/nodes/html-option-element/IHTMLOptionElement.ts +17 -0
  54. package/src/nodes/html-option-element/IHTMLOptionsCollection.ts +33 -0
  55. package/src/nodes/html-select-element/HTMLSelectElement.ts +239 -0
  56. package/src/nodes/html-select-element/HTMLSelectElementValueSanitizer.ts +15 -0
  57. package/src/nodes/html-select-element/IHTMLSelectElement.ts +27 -0
  58. package/src/nodes/{html-input-element → validity-state}/ValidityState.ts +13 -5
  59. package/lib/nodes/html-input-element/ValidityState.js.map +0 -1
@@ -1,4 +1,5 @@
1
- import HTMLInputElement from './HTMLInputElement';
1
+ import HTMLInputElement from '../html-input-element/HTMLInputElement';
2
+ import HTMLSelectElement from '../html-select-element/HTMLSelectElement';
2
3
 
3
4
  /**
4
5
  * Input validity state.
@@ -12,14 +13,14 @@ export default class ValidityState {
12
13
  public rangeOverflow = false;
13
14
  public rangeUnderflow = false;
14
15
  public stepMismatch = false;
15
- private element: HTMLInputElement = null;
16
+ private element: HTMLInputElement | HTMLSelectElement = null;
16
17
 
17
18
  /**
18
19
  * Constructor.
19
20
  *
20
21
  * @param element Input element.
21
22
  */
22
- constructor(element: HTMLInputElement) {
23
+ constructor(element: HTMLInputElement | HTMLSelectElement) {
23
24
  this.element = element;
24
25
  }
25
26
 
@@ -29,7 +30,10 @@ export default class ValidityState {
29
30
  * @returns "true" if valid.
30
31
  */
31
32
  public get tooLong(): boolean {
32
- return this.element.maxLength && this.element.value.length > this.element.maxLength;
33
+ if (this.element instanceof HTMLInputElement) {
34
+ return this.element.maxLength && this.element.value.length > this.element.maxLength;
35
+ }
36
+ return false;
33
37
  }
34
38
 
35
39
  /**
@@ -38,7 +42,11 @@ export default class ValidityState {
38
42
  * @returns "true" if valid.
39
43
  */
40
44
  public get tooShort(): boolean {
41
- return this.element.minLength && this.element.value.length < this.element.minLength;
45
+ if (this.element instanceof HTMLInputElement) {
46
+ return this.element.minLength && this.element.value.length < this.element.minLength;
47
+ }
48
+
49
+ return false;
42
50
  }
43
51
 
44
52
  /**
@@ -1 +0,0 @@
1
- {"version":3,"file":"ValidityState.js","sourceRoot":"","sources":["../../../src/nodes/html-input-element/ValidityState.ts"],"names":[],"mappings":";;AAEA;;;;GAIG;AACH,MAAqB,aAAa;IASjC;;;;OAIG;IACH,YAAY,OAAyB;QAb9B,aAAQ,GAAG,KAAK,CAAC;QACjB,gBAAW,GAAG,KAAK,CAAC;QACpB,oBAAe,GAAG,KAAK,CAAC;QACxB,kBAAa,GAAG,KAAK,CAAC;QACtB,mBAAc,GAAG,KAAK,CAAC;QACvB,iBAAY,GAAG,KAAK,CAAC;QACpB,YAAO,GAAqB,IAAI,CAAC;QAQxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IACrF,CAAC;IAED;;;;OAIG;IACH,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IACrF,CAAC;IAED;;;;OAIG;IACH,IAAW,YAAY;QACtB,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,IAAW,KAAK;QACf,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACpC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE;gBACd,OAAO,KAAK,CAAC;aACb;SACD;QAED,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;IACpF,CAAC;CACD;AApED,gCAoEC"}