happy-dom 9.1.6 → 9.1.8

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 (45) hide show
  1. package/lib/nodes/document/Document.d.ts +5 -5
  2. package/lib/nodes/document/Document.js +1 -1
  3. package/lib/nodes/document/Document.js.map +1 -1
  4. package/lib/nodes/document/IDocument.d.ts +1 -1
  5. package/lib/nodes/document-fragment/DocumentFragment.d.ts +1 -1
  6. package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
  7. package/lib/nodes/element/Element.d.ts +4 -4
  8. package/lib/nodes/element/Element.js +2 -2
  9. package/lib/nodes/element/Element.js.map +1 -1
  10. package/lib/nodes/element/ElementUtility.js +1 -1
  11. package/lib/nodes/element/ElementUtility.js.map +1 -1
  12. package/lib/nodes/element/HTMLCollection.d.ts +10 -3
  13. package/lib/nodes/element/HTMLCollection.js +18 -5
  14. package/lib/nodes/element/HTMLCollection.js.map +1 -1
  15. package/lib/nodes/element/IHTMLCollection.d.ts +2 -2
  16. package/lib/nodes/html-form-element/HTMLFormControlsCollection.d.ts +21 -3
  17. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js +41 -6
  18. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js.map +1 -1
  19. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.d.ts +1 -2
  20. package/lib/nodes/html-select-element/HTMLOptionsCollection.d.ts +1 -1
  21. package/lib/nodes/html-select-element/HTMLOptionsCollection.js.map +1 -1
  22. package/lib/nodes/html-select-element/HTMLSelectElement.js +1 -1
  23. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
  24. package/lib/nodes/html-select-element/IHTMLOptionsCollection.d.ts +1 -1
  25. package/lib/nodes/parent-node/IParentNode.d.ts +4 -4
  26. package/lib/nodes/parent-node/ParentNodeUtility.d.ts +3 -3
  27. package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
  28. package/lib/nodes/svg-element/SVGElement.js +2 -1
  29. package/lib/nodes/svg-element/SVGElement.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/nodes/document/Document.ts +6 -14
  32. package/src/nodes/document/IDocument.ts +1 -1
  33. package/src/nodes/document-fragment/DocumentFragment.ts +1 -1
  34. package/src/nodes/element/Element.ts +13 -14
  35. package/src/nodes/element/ElementUtility.ts +8 -7
  36. package/src/nodes/element/HTMLCollection.ts +21 -10
  37. package/src/nodes/element/IHTMLCollection.ts +2 -2
  38. package/src/nodes/html-form-element/HTMLFormControlsCollection.ts +53 -13
  39. package/src/nodes/html-form-element/IHTMLFormControlsCollection.ts +2 -8
  40. package/src/nodes/html-select-element/HTMLOptionsCollection.ts +1 -1
  41. package/src/nodes/html-select-element/HTMLSelectElement.ts +1 -3
  42. package/src/nodes/html-select-element/IHTMLOptionsCollection.ts +1 -2
  43. package/src/nodes/parent-node/IParentNode.ts +4 -7
  44. package/src/nodes/parent-node/ParentNodeUtility.ts +9 -9
  45. package/src/nodes/svg-element/SVGElement.ts +3 -1
@@ -7,7 +7,7 @@ export default interface IParentNode extends INode {
7
7
  readonly childElementCount: number;
8
8
  readonly firstElementChild: IElement;
9
9
  readonly lastElementChild: IElement;
10
- readonly children: IHTMLCollection<IElement, IElement>;
10
+ readonly children: IHTMLCollection<IElement>;
11
11
 
12
12
  /**
13
13
  * Inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
@@ -45,7 +45,7 @@ export default interface IParentNode extends INode {
45
45
  * @param className Tag name.
46
46
  * @returns Matching element.
47
47
  */
48
- getElementsByClassName(className: string): IHTMLCollection<IElement, IElement>;
48
+ getElementsByClassName(className: string): IHTMLCollection<IElement>;
49
49
 
50
50
  /**
51
51
  * Returns an elements by tag name.
@@ -53,7 +53,7 @@ export default interface IParentNode extends INode {
53
53
  * @param tagName Tag name.
54
54
  * @returns Matching element.
55
55
  */
56
- getElementsByTagName(tagName: string): IHTMLCollection<IElement, IElement>;
56
+ getElementsByTagName(tagName: string): IHTMLCollection<IElement>;
57
57
 
58
58
  /**
59
59
  * Returns an elements by tag name and namespace.
@@ -62,10 +62,7 @@ export default interface IParentNode extends INode {
62
62
  * @param tagName Tag name.
63
63
  * @returns Matching element.
64
64
  */
65
- getElementsByTagNameNS(
66
- namespaceURI: string,
67
- tagName: string
68
- ): IHTMLCollection<IElement, IElement>;
65
+ getElementsByTagNameNS(namespaceURI: string, tagName: string): IHTMLCollection<IElement>;
69
66
 
70
67
  /**
71
68
  * Replaces the existing children of a node with a specified new set of children.
@@ -79,14 +79,14 @@ export default class ParentNodeUtility {
79
79
  public static getElementsByClassName(
80
80
  parentNode: IElement | IDocumentFragment | IDocument,
81
81
  className: string
82
- ): IHTMLCollection<IElement, IElement> {
83
- let matches = new HTMLCollection<IElement, IElement>();
82
+ ): IHTMLCollection<IElement> {
83
+ let matches = new HTMLCollection<IElement>();
84
84
 
85
85
  for (const child of parentNode.children) {
86
86
  if (child.className.split(' ').includes(className)) {
87
87
  matches.push(child);
88
88
  }
89
- matches = <HTMLCollection<IElement, IElement>>(
89
+ matches = <HTMLCollection<IElement>>(
90
90
  matches.concat(this.getElementsByClassName(<IElement>child, className))
91
91
  );
92
92
  }
@@ -104,16 +104,16 @@ export default class ParentNodeUtility {
104
104
  public static getElementsByTagName(
105
105
  parentNode: IElement | IDocumentFragment | IDocument,
106
106
  tagName: string
107
- ): IHTMLCollection<IElement, IElement> {
107
+ ): IHTMLCollection<IElement> {
108
108
  const upperTagName = tagName.toUpperCase();
109
109
  const includeAll = tagName === '*';
110
- let matches = new HTMLCollection<IElement, IElement>();
110
+ let matches = new HTMLCollection<IElement>();
111
111
 
112
112
  for (const child of parentNode.children) {
113
113
  if (includeAll || child.tagName === upperTagName) {
114
114
  matches.push(child);
115
115
  }
116
- matches = <HTMLCollection<IElement, IElement>>(
116
+ matches = <HTMLCollection<IElement>>(
117
117
  matches.concat(this.getElementsByTagName(<IElement>child, tagName))
118
118
  );
119
119
  }
@@ -133,16 +133,16 @@ export default class ParentNodeUtility {
133
133
  parentNode: IElement | IDocumentFragment | IDocument,
134
134
  namespaceURI: string,
135
135
  tagName: string
136
- ): IHTMLCollection<IElement, IElement> {
136
+ ): IHTMLCollection<IElement> {
137
137
  const upperTagName = tagName.toUpperCase();
138
138
  const includeAll = tagName === '*';
139
- let matches = new HTMLCollection<IElement, IElement>();
139
+ let matches = new HTMLCollection<IElement>();
140
140
 
141
141
  for (const child of parentNode.children) {
142
142
  if ((includeAll || child.tagName === upperTagName) && child.namespaceURI === namespaceURI) {
143
143
  matches.push(child);
144
144
  }
145
- matches = <HTMLCollection<IElement, IElement>>(
145
+ matches = <HTMLCollection<IElement>>(
146
146
  matches.concat(this.getElementsByTagNameNS(<IElement>child, namespaceURI, tagName))
147
147
  );
148
148
  }
@@ -37,11 +37,13 @@ export default class SVGElement extends Element implements ISVGElement {
37
37
  * @returns Element.
38
38
  */
39
39
  public get ownerSVGElement(): ISVGSVGElement {
40
- const parent = this.parentNode;
40
+ let parent = this.parentNode;
41
41
  while (parent) {
42
42
  if (parent['tagName'] === 'SVG') {
43
43
  return <ISVGSVGElement>parent;
44
44
  }
45
+
46
+ parent = parent.parentNode;
45
47
  }
46
48
  return null;
47
49
  }