happy-dom 20.0.3 → 20.0.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.
- package/lib/PropertySymbol.d.ts +1 -0
- package/lib/PropertySymbol.d.ts.map +1 -1
- package/lib/PropertySymbol.js +1 -0
- package/lib/PropertySymbol.js.map +1 -1
- package/lib/dom/DOMTokenList.d.ts +4 -4
- package/lib/dom/DOMTokenList.d.ts.map +1 -1
- package/lib/fetch/Headers.d.ts +4 -4
- package/lib/fetch/Headers.d.ts.map +1 -1
- package/lib/form-data/FormData.d.ts +8 -5
- package/lib/form-data/FormData.d.ts.map +1 -1
- package/lib/form-data/FormData.js +17 -3
- package/lib/form-data/FormData.js.map +1 -1
- package/lib/nodes/element/HTMLCollection.d.ts +1 -1
- package/lib/nodes/element/HTMLCollection.d.ts.map +1 -1
- package/lib/nodes/element/NamedNodeMap.d.ts +1 -1
- package/lib/nodes/element/NamedNodeMap.d.ts.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormElement.js +1 -1
- package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
- package/lib/nodes/html-media-element/TextTrackList.d.ts +1 -1
- package/lib/nodes/html-media-element/TextTrackList.d.ts.map +1 -1
- package/lib/nodes/node/NodeList.d.ts +4 -4
- package/lib/nodes/node/NodeList.d.ts.map +1 -1
- package/lib/nodes/node/NodeList.js.map +1 -1
- package/lib/svg/SVGLengthList.d.ts +1 -1
- package/lib/svg/SVGLengthList.d.ts.map +1 -1
- package/lib/svg/SVGNumberList.d.ts +1 -1
- package/lib/svg/SVGNumberList.d.ts.map +1 -1
- package/lib/svg/SVGPointList.d.ts +1 -1
- package/lib/svg/SVGPointList.d.ts.map +1 -1
- package/lib/svg/SVGStringList.d.ts +1 -1
- package/lib/svg/SVGStringList.d.ts.map +1 -1
- package/lib/svg/SVGTransformList.d.ts +1 -1
- package/lib/svg/SVGTransformList.d.ts.map +1 -1
- package/lib/tree-walker/TreeWalker.d.ts +12 -1
- package/lib/tree-walker/TreeWalker.d.ts.map +1 -1
- package/lib/tree-walker/TreeWalker.js +35 -16
- package/lib/tree-walker/TreeWalker.js.map +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/PropertySymbol.ts +1 -0
- package/src/dom/DOMTokenList.ts +4 -4
- package/src/fetch/Headers.ts +4 -4
- package/src/form-data/FormData.ts +30 -8
- package/src/nodes/element/HTMLCollection.ts +1 -1
- package/src/nodes/element/NamedNodeMap.ts +1 -1
- package/src/nodes/html-form-element/HTMLFormElement.ts +1 -1
- package/src/nodes/html-media-element/TextTrackList.ts +1 -1
- package/src/nodes/node/NodeList.ts +10 -10
- package/src/svg/SVGLengthList.ts +1 -1
- package/src/svg/SVGNumberList.ts +1 -1
- package/src/svg/SVGPointList.ts +1 -1
- package/src/svg/SVGStringList.ts +1 -1
- package/src/svg/SVGTransformList.ts +1 -1
- package/src/tree-walker/TreeWalker.ts +39 -16
package/src/svg/SVGNumberList.ts
CHANGED
|
@@ -160,7 +160,7 @@ export default class SVGNumberList {
|
|
|
160
160
|
/**
|
|
161
161
|
* Returns an iterator, allowing you to go through all values of the key/value pairs contained in this object.
|
|
162
162
|
*/
|
|
163
|
-
public [Symbol.iterator]():
|
|
163
|
+
public [Symbol.iterator](): ArrayIterator<SVGNumber> {
|
|
164
164
|
return this[PropertySymbol.getItemList]().values();
|
|
165
165
|
}
|
|
166
166
|
|
package/src/svg/SVGPointList.ts
CHANGED
|
@@ -156,7 +156,7 @@ export default class SVGPointList {
|
|
|
156
156
|
/**
|
|
157
157
|
* Returns an iterator, allowing you to go through all values of the key/value pairs contained in this object.
|
|
158
158
|
*/
|
|
159
|
-
public [Symbol.iterator]():
|
|
159
|
+
public [Symbol.iterator](): ArrayIterator<SVGPoint> {
|
|
160
160
|
return this[PropertySymbol.getItemList]().values();
|
|
161
161
|
}
|
|
162
162
|
|
package/src/svg/SVGStringList.ts
CHANGED
|
@@ -159,7 +159,7 @@ export default class SVGStringList {
|
|
|
159
159
|
/**
|
|
160
160
|
* Returns an iterator, allowing you to go through all values of the key/value pairs contained in this object.
|
|
161
161
|
*/
|
|
162
|
-
public [Symbol.iterator]():
|
|
162
|
+
public [Symbol.iterator](): ArrayIterator<string> {
|
|
163
163
|
return this[PropertySymbol.getItemList]().values();
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -157,7 +157,7 @@ export default class SVGTransformList {
|
|
|
157
157
|
/**
|
|
158
158
|
* Returns an iterator, allowing you to go through all values of the key/value pairs contained in this object.
|
|
159
159
|
*/
|
|
160
|
-
public [Symbol.iterator]():
|
|
160
|
+
public [Symbol.iterator](): ArrayIterator<SVGTransform> {
|
|
161
161
|
return this[PropertySymbol.getItemList]().values();
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -25,7 +25,7 @@ export default class TreeWalker {
|
|
|
25
25
|
public root: Node;
|
|
26
26
|
public whatToShow = -1;
|
|
27
27
|
public filter: INodeFilter | null = null;
|
|
28
|
-
|
|
28
|
+
#currentNode: Node | null = null;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Constructor.
|
|
@@ -42,7 +42,30 @@ export default class TreeWalker {
|
|
|
42
42
|
this.root = root;
|
|
43
43
|
this.whatToShow = whatToShow;
|
|
44
44
|
this.filter = filter;
|
|
45
|
-
this
|
|
45
|
+
this.#currentNode = root;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns the current Node.
|
|
50
|
+
*
|
|
51
|
+
* @returns Current node.
|
|
52
|
+
*/
|
|
53
|
+
public get currentNode(): Node | null {
|
|
54
|
+
return this.#currentNode;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Sets the current Node.
|
|
59
|
+
*
|
|
60
|
+
* @param node Node.
|
|
61
|
+
*/
|
|
62
|
+
public set currentNode(node: Node | null) {
|
|
63
|
+
if (!(node instanceof Node)) {
|
|
64
|
+
throw new this.root[PropertySymbol.window].TypeError(
|
|
65
|
+
"Failed to set the 'currentNode' property on 'TreeWalker': Failed to convert value to 'Node'."
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
this.#currentNode = node;
|
|
46
69
|
}
|
|
47
70
|
|
|
48
71
|
/**
|
|
@@ -51,12 +74,12 @@ export default class TreeWalker {
|
|
|
51
74
|
* @returns Current node.
|
|
52
75
|
*/
|
|
53
76
|
public parentNode(): Node | null {
|
|
54
|
-
let node = this
|
|
77
|
+
let node = this.#currentNode;
|
|
55
78
|
while (node !== null && node !== this.root) {
|
|
56
79
|
node = node.parentNode;
|
|
57
80
|
if (node !== null && this[PropertySymbol.filterNode](node) === NodeFilter.FILTER_ACCEPT) {
|
|
58
|
-
this
|
|
59
|
-
return this
|
|
81
|
+
this.#currentNode = node;
|
|
82
|
+
return this.#currentNode;
|
|
60
83
|
}
|
|
61
84
|
}
|
|
62
85
|
return null;
|
|
@@ -104,7 +127,7 @@ export default class TreeWalker {
|
|
|
104
127
|
* @returns Current node.
|
|
105
128
|
*/
|
|
106
129
|
public previousNode(): Node | null {
|
|
107
|
-
let node = this
|
|
130
|
+
let node = this.#currentNode;
|
|
108
131
|
|
|
109
132
|
while (node !== this.root) {
|
|
110
133
|
let sibling = node?.previousSibling || null;
|
|
@@ -119,7 +142,7 @@ export default class TreeWalker {
|
|
|
119
142
|
}
|
|
120
143
|
|
|
121
144
|
if (result === NodeFilter.FILTER_ACCEPT) {
|
|
122
|
-
this
|
|
145
|
+
this.#currentNode = node;
|
|
123
146
|
return node;
|
|
124
147
|
}
|
|
125
148
|
|
|
@@ -133,7 +156,7 @@ export default class TreeWalker {
|
|
|
133
156
|
node = node!.parentNode;
|
|
134
157
|
|
|
135
158
|
if (this[PropertySymbol.filterNode](node) === NodeFilter.FILTER_ACCEPT) {
|
|
136
|
-
this
|
|
159
|
+
this.#currentNode = node;
|
|
137
160
|
return node;
|
|
138
161
|
}
|
|
139
162
|
}
|
|
@@ -147,7 +170,7 @@ export default class TreeWalker {
|
|
|
147
170
|
* @returns Current node.
|
|
148
171
|
*/
|
|
149
172
|
public nextNode(): Node | null {
|
|
150
|
-
let node: Node | null = this
|
|
173
|
+
let node: Node | null = this.#currentNode;
|
|
151
174
|
let result = NodeFilter.FILTER_ACCEPT;
|
|
152
175
|
|
|
153
176
|
if (node === null) {
|
|
@@ -160,7 +183,7 @@ export default class TreeWalker {
|
|
|
160
183
|
result = this[PropertySymbol.filterNode](node!);
|
|
161
184
|
|
|
162
185
|
if (result === NodeFilter.FILTER_ACCEPT) {
|
|
163
|
-
this
|
|
186
|
+
this.#currentNode = node;
|
|
164
187
|
return node;
|
|
165
188
|
}
|
|
166
189
|
}
|
|
@@ -187,7 +210,7 @@ export default class TreeWalker {
|
|
|
187
210
|
result = this[PropertySymbol.filterNode](node);
|
|
188
211
|
|
|
189
212
|
if (result === NodeFilter.FILTER_ACCEPT) {
|
|
190
|
-
this
|
|
213
|
+
this.#currentNode = node;
|
|
191
214
|
return node;
|
|
192
215
|
}
|
|
193
216
|
}
|
|
@@ -225,7 +248,7 @@ export default class TreeWalker {
|
|
|
225
248
|
* @returns Node.
|
|
226
249
|
*/
|
|
227
250
|
#traverseChildren(type: TraverseChildrenTypeEnum): Node | null {
|
|
228
|
-
let node = this
|
|
251
|
+
let node = this.#currentNode;
|
|
229
252
|
|
|
230
253
|
if (!node) {
|
|
231
254
|
return null;
|
|
@@ -237,7 +260,7 @@ export default class TreeWalker {
|
|
|
237
260
|
const result = this[PropertySymbol.filterNode](node);
|
|
238
261
|
|
|
239
262
|
if (result === NodeFilter.FILTER_ACCEPT) {
|
|
240
|
-
this
|
|
263
|
+
this.#currentNode = node;
|
|
241
264
|
return node;
|
|
242
265
|
}
|
|
243
266
|
|
|
@@ -258,7 +281,7 @@ export default class TreeWalker {
|
|
|
258
281
|
break;
|
|
259
282
|
}
|
|
260
283
|
const parent: Node | null = node.parentNode;
|
|
261
|
-
if (parent === null || parent === this.root || parent === this
|
|
284
|
+
if (parent === null || parent === this.root || parent === this.#currentNode) {
|
|
262
285
|
return null;
|
|
263
286
|
}
|
|
264
287
|
node = parent;
|
|
@@ -275,7 +298,7 @@ export default class TreeWalker {
|
|
|
275
298
|
* @returns Node.
|
|
276
299
|
*/
|
|
277
300
|
#traverseSiblings(type: TraverseSiblingsTypeEnum): Node | null {
|
|
278
|
-
let node: Node | null = this
|
|
301
|
+
let node: Node | null = this.#currentNode;
|
|
279
302
|
|
|
280
303
|
if (!node || node === this.root) {
|
|
281
304
|
return null;
|
|
@@ -290,7 +313,7 @@ export default class TreeWalker {
|
|
|
290
313
|
const result = this[PropertySymbol.filterNode](node);
|
|
291
314
|
|
|
292
315
|
if (result === NodeFilter.FILTER_ACCEPT) {
|
|
293
|
-
this
|
|
316
|
+
this.#currentNode = node;
|
|
294
317
|
return node;
|
|
295
318
|
}
|
|
296
319
|
|