happy-dom 15.11.3 → 15.11.5

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.
Files changed (54) hide show
  1. package/cjs/ClassMethodBinder.cjs +2 -1
  2. package/cjs/ClassMethodBinder.cjs.map +1 -1
  3. package/cjs/ClassMethodBinder.d.ts.map +1 -1
  4. package/cjs/cookie/urilities/CookieStringUtility.cjs +1 -1
  5. package/cjs/cookie/urilities/CookieStringUtility.cjs.map +1 -1
  6. package/cjs/css/utilities/CSSParser.cjs +1 -1
  7. package/cjs/css/utilities/CSSParser.cjs.map +1 -1
  8. package/cjs/nodes/html-hyperlink-element/HTMLHyperlinkElementUtility.cjs +1 -1
  9. package/cjs/nodes/html-hyperlink-element/HTMLHyperlinkElementUtility.cjs.map +1 -1
  10. package/cjs/nodes/html-meter-element/HTMLMeterElement.cjs +12 -6
  11. package/cjs/nodes/html-meter-element/HTMLMeterElement.cjs.map +1 -1
  12. package/cjs/nodes/html-meter-element/HTMLMeterElement.d.ts.map +1 -1
  13. package/cjs/nodes/html-progress-element/HTMLProgressElement.cjs +4 -2
  14. package/cjs/nodes/html-progress-element/HTMLProgressElement.cjs.map +1 -1
  15. package/cjs/nodes/html-progress-element/HTMLProgressElement.d.ts.map +1 -1
  16. package/cjs/nodes/html-select-element/HTMLSelectElement.cjs +0 -12
  17. package/cjs/nodes/html-select-element/HTMLSelectElement.cjs.map +1 -1
  18. package/cjs/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
  19. package/cjs/query-selector/SelectorItem.cjs +1 -1
  20. package/cjs/query-selector/SelectorItem.cjs.map +1 -1
  21. package/cjs/query-selector/SelectorParser.cjs +1 -1
  22. package/cjs/query-selector/SelectorParser.cjs.map +1 -1
  23. package/lib/ClassMethodBinder.d.ts.map +1 -1
  24. package/lib/ClassMethodBinder.js +2 -1
  25. package/lib/ClassMethodBinder.js.map +1 -1
  26. package/lib/cookie/urilities/CookieStringUtility.js +1 -1
  27. package/lib/cookie/urilities/CookieStringUtility.js.map +1 -1
  28. package/lib/css/utilities/CSSParser.js +1 -1
  29. package/lib/css/utilities/CSSParser.js.map +1 -1
  30. package/lib/nodes/html-hyperlink-element/HTMLHyperlinkElementUtility.js +1 -1
  31. package/lib/nodes/html-hyperlink-element/HTMLHyperlinkElementUtility.js.map +1 -1
  32. package/lib/nodes/html-meter-element/HTMLMeterElement.d.ts.map +1 -1
  33. package/lib/nodes/html-meter-element/HTMLMeterElement.js +12 -6
  34. package/lib/nodes/html-meter-element/HTMLMeterElement.js.map +1 -1
  35. package/lib/nodes/html-progress-element/HTMLProgressElement.d.ts.map +1 -1
  36. package/lib/nodes/html-progress-element/HTMLProgressElement.js +4 -2
  37. package/lib/nodes/html-progress-element/HTMLProgressElement.js.map +1 -1
  38. package/lib/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
  39. package/lib/nodes/html-select-element/HTMLSelectElement.js +0 -12
  40. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
  41. package/lib/query-selector/SelectorItem.js +1 -1
  42. package/lib/query-selector/SelectorItem.js.map +1 -1
  43. package/lib/query-selector/SelectorParser.js +1 -1
  44. package/lib/query-selector/SelectorParser.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/ClassMethodBinder.ts +2 -1
  47. package/src/cookie/urilities/CookieStringUtility.ts +1 -1
  48. package/src/css/utilities/CSSParser.ts +1 -1
  49. package/src/nodes/html-hyperlink-element/HTMLHyperlinkElementUtility.ts +1 -1
  50. package/src/nodes/html-meter-element/HTMLMeterElement.ts +12 -6
  51. package/src/nodes/html-progress-element/HTMLProgressElement.ts +4 -2
  52. package/src/nodes/html-select-element/HTMLSelectElement.ts +0 -15
  53. package/src/query-selector/SelectorItem.ts +1 -1
  54. package/src/query-selector/SelectorParser.ts +1 -1
@@ -32,7 +32,8 @@ export default class HTMLMeterElement extends HTMLElement {
32
32
  * @param high High.
33
33
  */
34
34
  public set high(high: number) {
35
- if (typeof high !== 'number') {
35
+ high = typeof high !== 'number' ? Number(high) : high;
36
+ if (isNaN(high)) {
36
37
  throw new this[PropertySymbol.window].TypeError(
37
38
  "Failed to set the 'high' property on 'HTMLMeterElement': The provided double value is non-finite."
38
39
  );
@@ -63,7 +64,8 @@ export default class HTMLMeterElement extends HTMLElement {
63
64
  * @param low Low.
64
65
  */
65
66
  public set low(low: number) {
66
- if (typeof low !== 'number') {
67
+ low = typeof low !== 'number' ? Number(low) : low;
68
+ if (isNaN(low)) {
67
69
  throw new this[PropertySymbol.window].TypeError(
68
70
  "Failed to set the 'low' property on 'HTMLMeterElement': The provided double value is non-finite."
69
71
  );
@@ -94,7 +96,8 @@ export default class HTMLMeterElement extends HTMLElement {
94
96
  * @param max Max.
95
97
  */
96
98
  public set max(max: number) {
97
- if (typeof max !== 'number') {
99
+ max = typeof max !== 'number' ? Number(max) : max;
100
+ if (isNaN(max)) {
98
101
  throw new this[PropertySymbol.window].TypeError(
99
102
  "Failed to set the 'max' property on 'HTMLMeterElement': The provided double value is non-finite."
100
103
  );
@@ -125,7 +128,8 @@ export default class HTMLMeterElement extends HTMLElement {
125
128
  * @param min Min.
126
129
  */
127
130
  public set min(min: number) {
128
- if (typeof min !== 'number') {
131
+ min = typeof min !== 'number' ? Number(min) : min;
132
+ if (isNaN(min)) {
129
133
  throw new this[PropertySymbol.window].TypeError(
130
134
  "Failed to set the 'min' property on 'HTMLMeterElement': The provided double value is non-finite."
131
135
  );
@@ -159,7 +163,8 @@ export default class HTMLMeterElement extends HTMLElement {
159
163
  * @param optimum Optimum.
160
164
  */
161
165
  public set optimum(optimum: number) {
162
- if (typeof optimum !== 'number') {
166
+ optimum = typeof optimum !== 'number' ? Number(optimum) : optimum;
167
+ if (isNaN(optimum)) {
163
168
  throw new this[PropertySymbol.window].TypeError(
164
169
  "Failed to set the 'optimum' property on 'HTMLMeterElement': The provided double value is non-finite."
165
170
  );
@@ -190,7 +195,8 @@ export default class HTMLMeterElement extends HTMLElement {
190
195
  * @param value Value.
191
196
  */
192
197
  public set value(value: number) {
193
- if (typeof value !== 'number') {
198
+ value = typeof value !== 'number' ? Number(value) : value;
199
+ if (isNaN(value)) {
194
200
  throw new this[PropertySymbol.window].TypeError(
195
201
  "Failed to set the 'value' property on 'HTMLMeterElement': The provided double value is non-finite."
196
202
  );
@@ -32,7 +32,8 @@ export default class HTMLProgressElement extends HTMLElement {
32
32
  * @param max Max.
33
33
  */
34
34
  public set max(max: number) {
35
- if (typeof max !== 'number') {
35
+ max = typeof max !== 'number' ? Number(max) : max;
36
+ if (isNaN(max)) {
36
37
  throw new this[PropertySymbol.window].TypeError(
37
38
  "Failed to set the 'max' property on 'HTMLProgressElement': The provided double value is non-finite."
38
39
  );
@@ -63,7 +64,8 @@ export default class HTMLProgressElement extends HTMLElement {
63
64
  * @param value Value.
64
65
  */
65
66
  public set value(value: number) {
66
- if (typeof value !== 'number') {
67
+ value = typeof value !== 'number' ? Number(value) : value;
68
+ if (isNaN(value)) {
67
69
  throw new this[PropertySymbol.window].TypeError(
68
70
  "Failed to set the 'value' property on 'HTMLProgressElement': The provided double value is non-finite."
69
71
  );
@@ -385,7 +385,6 @@ export default class HTMLSelectElement extends HTMLElement {
385
385
  */
386
386
  public set value(value: string) {
387
387
  const options = QuerySelector.querySelectorAll(this, 'option')[PropertySymbol.items];
388
- const previousSelectedIndex = this[PropertySymbol.selectedIndex];
389
388
 
390
389
  this[PropertySymbol.selectedIndex] = -1;
391
390
 
@@ -399,10 +398,6 @@ export default class HTMLSelectElement extends HTMLElement {
399
398
  option[PropertySymbol.selectedness] = false;
400
399
  }
401
400
  }
402
-
403
- if (previousSelectedIndex !== this[PropertySymbol.selectedIndex]) {
404
- this.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));
405
- }
406
401
  }
407
402
 
408
403
  /**
@@ -427,7 +422,6 @@ export default class HTMLSelectElement extends HTMLElement {
427
422
  }
428
423
 
429
424
  const options = QuerySelector.querySelectorAll(this, 'option')[PropertySymbol.items];
430
- const previousSelectedIndex = this[PropertySymbol.selectedIndex];
431
425
 
432
426
  this[PropertySymbol.selectedIndex] = -1;
433
427
 
@@ -443,10 +437,6 @@ export default class HTMLSelectElement extends HTMLElement {
443
437
  this[PropertySymbol.selectedIndex] = selectedIndex;
444
438
  }
445
439
  }
446
-
447
- if (previousSelectedIndex !== this[PropertySymbol.selectedIndex]) {
448
- this.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));
449
- }
450
440
  }
451
441
 
452
442
  /**
@@ -669,7 +659,6 @@ export default class HTMLSelectElement extends HTMLElement {
669
659
  const isMultiple = this.hasAttribute('multiple');
670
660
  const options = QuerySelector.querySelectorAll(this, 'option')[PropertySymbol.items];
671
661
  const selected: HTMLOptionElement[] = [];
672
- const previousSelectedIndex = this[PropertySymbol.selectedIndex];
673
662
 
674
663
  if (selectedOption) {
675
664
  this[PropertySymbol.selectedIndex] = -1;
@@ -728,10 +717,6 @@ export default class HTMLSelectElement extends HTMLElement {
728
717
  }
729
718
  }
730
719
  }
731
-
732
- if (previousSelectedIndex !== this[PropertySymbol.selectedIndex]) {
733
- this.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));
734
- }
735
720
  }
736
721
 
737
722
  /**
@@ -330,7 +330,7 @@ export default class SelectorItem {
330
330
  return null;
331
331
  case 'has':
332
332
  let priorityWeightForHas = 0;
333
- if (pseudo.arguments.startsWith('+')) {
333
+ if (pseudo.arguments[0] === '+') {
334
334
  const nextSibling = element.nextElementSibling;
335
335
  if (!nextSibling) {
336
336
  return null;
@@ -329,7 +329,7 @@ export default class SelectorParser {
329
329
  // The ":has()" pseudo selector doesn't allow for it to be nested inside another ":has()" pseudo selector, as it can lead to cyclic querying.
330
330
  if (!args.includes(':has(')) {
331
331
  for (const group of this.getSelectorGroups(
332
- args.startsWith('+') ? args.replace('+', '') : args,
332
+ args[0] === '+' ? args.replace('+', '') : args,
333
333
  options
334
334
  )) {
335
335
  hasSelectorItems.push(group[0]);