happy-dom 17.1.2 → 17.1.3
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/cjs/PropertySymbol.cjs +4 -4
- package/cjs/PropertySymbol.cjs.map +1 -1
- package/cjs/PropertySymbol.d.ts +2 -2
- package/cjs/PropertySymbol.d.ts.map +1 -1
- package/cjs/dom/DOMStringMap.cjs +1 -1
- package/cjs/dom/DOMStringMap.cjs.map +1 -1
- package/cjs/exception/DOMExceptionNameEnum.cjs +1 -0
- package/cjs/exception/DOMExceptionNameEnum.cjs.map +1 -1
- package/cjs/exception/DOMExceptionNameEnum.d.ts +2 -1
- package/cjs/exception/DOMExceptionNameEnum.d.ts.map +1 -1
- package/cjs/html-serializer/HTMLSerializer.cjs +5 -5
- package/cjs/html-serializer/HTMLSerializer.cjs.map +1 -1
- package/cjs/nodes/document/Document.cjs +12 -1
- package/cjs/nodes/document/Document.cjs.map +1 -1
- package/cjs/nodes/document/Document.d.ts.map +1 -1
- package/cjs/nodes/element/Element.cjs +9 -5
- package/cjs/nodes/element/Element.cjs.map +1 -1
- package/cjs/nodes/element/Element.d.ts.map +1 -1
- package/cjs/nodes/element/NamedNodeMap.cjs +34 -26
- package/cjs/nodes/element/NamedNodeMap.cjs.map +1 -1
- package/cjs/nodes/element/NamedNodeMap.d.ts +3 -2
- package/cjs/nodes/element/NamedNodeMap.d.ts.map +1 -1
- package/cjs/nodes/element/NamedNodeMapProxyFactory.cjs +22 -16
- package/cjs/nodes/element/NamedNodeMapProxyFactory.cjs.map +1 -1
- package/cjs/nodes/element/NamedNodeMapProxyFactory.d.ts.map +1 -1
- package/cjs/nodes/html-element/HTMLElement.cjs +10 -7
- package/cjs/nodes/html-element/HTMLElement.cjs.map +1 -1
- package/cjs/nodes/html-element/HTMLElement.d.ts.map +1 -1
- package/cjs/nodes/node/Node.cjs +3 -3
- package/cjs/nodes/node/Node.cjs.map +1 -1
- package/cjs/nodes/node/NodeUtility.cjs +7 -8
- package/cjs/nodes/node/NodeUtility.cjs.map +1 -1
- package/cjs/nodes/node/NodeUtility.d.ts.map +1 -1
- package/cjs/xml-parser/XMLParser.cjs +2 -2
- package/cjs/xml-parser/XMLParser.cjs.map +1 -1
- package/cjs/xml-serializer/XMLSerializer.cjs +5 -8
- package/cjs/xml-serializer/XMLSerializer.cjs.map +1 -1
- package/cjs/xml-serializer/XMLSerializer.d.ts.map +1 -1
- package/lib/PropertySymbol.d.ts +2 -2
- package/lib/PropertySymbol.d.ts.map +1 -1
- package/lib/PropertySymbol.js +2 -2
- package/lib/PropertySymbol.js.map +1 -1
- package/lib/dom/DOMStringMap.js +1 -1
- package/lib/dom/DOMStringMap.js.map +1 -1
- package/lib/exception/DOMExceptionNameEnum.d.ts +2 -1
- package/lib/exception/DOMExceptionNameEnum.d.ts.map +1 -1
- package/lib/exception/DOMExceptionNameEnum.js +1 -0
- package/lib/exception/DOMExceptionNameEnum.js.map +1 -1
- package/lib/html-serializer/HTMLSerializer.js +5 -5
- package/lib/html-serializer/HTMLSerializer.js.map +1 -1
- package/lib/nodes/document/Document.d.ts.map +1 -1
- package/lib/nodes/document/Document.js +12 -1
- package/lib/nodes/document/Document.js.map +1 -1
- package/lib/nodes/element/Element.d.ts.map +1 -1
- package/lib/nodes/element/Element.js +9 -5
- package/lib/nodes/element/Element.js.map +1 -1
- package/lib/nodes/element/NamedNodeMap.d.ts +3 -2
- package/lib/nodes/element/NamedNodeMap.d.ts.map +1 -1
- package/lib/nodes/element/NamedNodeMap.js +34 -26
- package/lib/nodes/element/NamedNodeMap.js.map +1 -1
- package/lib/nodes/element/NamedNodeMapProxyFactory.d.ts.map +1 -1
- package/lib/nodes/element/NamedNodeMapProxyFactory.js +22 -16
- package/lib/nodes/element/NamedNodeMapProxyFactory.js.map +1 -1
- package/lib/nodes/html-element/HTMLElement.d.ts.map +1 -1
- package/lib/nodes/html-element/HTMLElement.js +10 -7
- package/lib/nodes/html-element/HTMLElement.js.map +1 -1
- package/lib/nodes/node/Node.js +3 -3
- package/lib/nodes/node/Node.js.map +1 -1
- package/lib/nodes/node/NodeUtility.d.ts.map +1 -1
- package/lib/nodes/node/NodeUtility.js +7 -8
- package/lib/nodes/node/NodeUtility.js.map +1 -1
- package/lib/xml-parser/XMLParser.js +2 -2
- package/lib/xml-parser/XMLParser.js.map +1 -1
- package/lib/xml-serializer/XMLSerializer.d.ts.map +1 -1
- package/lib/xml-serializer/XMLSerializer.js +5 -8
- package/lib/xml-serializer/XMLSerializer.js.map +1 -1
- package/package.json +1 -1
- package/src/PropertySymbol.ts +2 -2
- package/src/dom/DOMStringMap.ts +1 -1
- package/src/exception/DOMExceptionNameEnum.ts +2 -1
- package/src/html-serializer/HTMLSerializer.ts +5 -5
- package/src/nodes/document/Document.ts +22 -1
- package/src/nodes/element/Element.ts +20 -5
- package/src/nodes/element/NamedNodeMap.ts +42 -27
- package/src/nodes/element/NamedNodeMapProxyFactory.ts +22 -17
- package/src/nodes/html-element/HTMLElement.ts +11 -10
- package/src/nodes/node/Node.ts +5 -5
- package/src/nodes/node/NodeUtility.ts +7 -8
- package/src/xml-parser/XMLParser.ts +2 -2
- package/src/xml-serializer/XMLSerializer.ts +9 -12
@@ -14,11 +14,14 @@ import StringUtility from '../../utilities/StringUtility.js';
|
|
14
14
|
export default class NamedNodeMap {
|
15
15
|
[index: number]: Attr;
|
16
16
|
|
17
|
-
//
|
18
|
-
public [PropertySymbol.
|
17
|
+
// Items by attribute namespaceURI
|
18
|
+
public [PropertySymbol.itemsByNamespaceURI]: Map<string, Attr> = new Map();
|
19
19
|
|
20
|
-
// Items
|
21
|
-
public [PropertySymbol.
|
20
|
+
// Items by attribute name
|
21
|
+
public [PropertySymbol.itemsByName]: Map<string, Attr[]> = new Map();
|
22
|
+
|
23
|
+
// All items
|
24
|
+
public [PropertySymbol.items]: Map<string, Attr> = new Map();
|
22
25
|
|
23
26
|
public declare [PropertySymbol.ownerElement]: Element;
|
24
27
|
|
@@ -37,7 +40,7 @@ export default class NamedNodeMap {
|
|
37
40
|
* @returns Length.
|
38
41
|
*/
|
39
42
|
public get length(): number {
|
40
|
-
return this[PropertySymbol.
|
43
|
+
return this[PropertySymbol.items].size;
|
41
44
|
}
|
42
45
|
|
43
46
|
/**
|
@@ -64,7 +67,7 @@ export default class NamedNodeMap {
|
|
64
67
|
* @returns Iterator.
|
65
68
|
*/
|
66
69
|
public [Symbol.iterator](): IterableIterator<Attr> {
|
67
|
-
return this[PropertySymbol.
|
70
|
+
return this[PropertySymbol.items].values();
|
68
71
|
}
|
69
72
|
|
70
73
|
/**
|
@@ -73,7 +76,7 @@ export default class NamedNodeMap {
|
|
73
76
|
* @param index Index.
|
74
77
|
*/
|
75
78
|
public item(index: number): Attr | null {
|
76
|
-
const items = Array.from(this[PropertySymbol.
|
79
|
+
const items = Array.from(this[PropertySymbol.items].values());
|
77
80
|
return index >= 0 && items[index] ? items[index] : null;
|
78
81
|
}
|
79
82
|
|
@@ -91,9 +94,9 @@ export default class NamedNodeMap {
|
|
91
94
|
PropertySymbol.contentType
|
92
95
|
] === 'text/html'
|
93
96
|
) {
|
94
|
-
return this[PropertySymbol.
|
97
|
+
return this[PropertySymbol.itemsByName].get(StringUtility.asciiLowerCase(name))?.[0] || null;
|
95
98
|
}
|
96
|
-
return this[PropertySymbol.
|
99
|
+
return this[PropertySymbol.itemsByName].get(name)?.[0] || null;
|
97
100
|
}
|
98
101
|
|
99
102
|
/**
|
@@ -104,11 +107,17 @@ export default class NamedNodeMap {
|
|
104
107
|
* @returns Item.
|
105
108
|
*/
|
106
109
|
public getNamedItemNS(namespace: string, localName: string): Attr | null {
|
107
|
-
|
108
|
-
|
110
|
+
const item = this[PropertySymbol.itemsByNamespaceURI].get(`${namespace || ''}:${localName}`);
|
111
|
+
|
112
|
+
// It seems like an item cant have a prefix without a namespaceURI
|
113
|
+
// E.g. element.setAttribute('ns1:key', 'value1');
|
114
|
+
// expect(element.attributes.getNamedItemNS(null, 'key')).toBeNull();
|
115
|
+
|
116
|
+
if (item && (!item[PropertySymbol.prefix] || item[PropertySymbol.namespaceURI])) {
|
117
|
+
return item;
|
109
118
|
}
|
110
119
|
|
111
|
-
return
|
120
|
+
return null;
|
112
121
|
}
|
113
122
|
|
114
123
|
/**
|
@@ -199,26 +208,29 @@ export default class NamedNodeMap {
|
|
199
208
|
const replacedItem =
|
200
209
|
this.getNamedItemNS(item[PropertySymbol.namespaceURI], item[PropertySymbol.localName]) ||
|
201
210
|
null;
|
202
|
-
|
203
|
-
const namedItems = this[PropertySymbol.namedItems].get(item[PropertySymbol.name]);
|
211
|
+
const itemsByName = this[PropertySymbol.itemsByName].get(item[PropertySymbol.name]);
|
204
212
|
|
205
213
|
if (replacedItem === item) {
|
206
214
|
return item;
|
207
215
|
}
|
208
216
|
|
209
|
-
this[PropertySymbol.
|
217
|
+
this[PropertySymbol.itemsByNamespaceURI].set(
|
210
218
|
`${item[PropertySymbol.namespaceURI] || ''}:${item[PropertySymbol.localName]}`,
|
211
219
|
item
|
212
220
|
);
|
221
|
+
this[PropertySymbol.items].set(
|
222
|
+
`${item[PropertySymbol.namespaceURI] || ''}:${item[PropertySymbol.name]}`,
|
223
|
+
item
|
224
|
+
);
|
213
225
|
|
214
|
-
if (!
|
215
|
-
this[PropertySymbol.
|
226
|
+
if (!itemsByName?.length) {
|
227
|
+
this[PropertySymbol.itemsByName].set(item[PropertySymbol.name], [item]);
|
216
228
|
} else {
|
217
|
-
const index =
|
229
|
+
const index = itemsByName.indexOf(replacedItem);
|
218
230
|
if (index !== -1) {
|
219
|
-
|
231
|
+
itemsByName.splice(index, 1);
|
220
232
|
}
|
221
|
-
|
233
|
+
itemsByName.push(item);
|
222
234
|
}
|
223
235
|
|
224
236
|
if (!ignoreListeners) {
|
@@ -237,19 +249,22 @@ export default class NamedNodeMap {
|
|
237
249
|
public [PropertySymbol.removeNamedItem](item: Attr, ignoreListeners = false): void {
|
238
250
|
item[PropertySymbol.ownerElement] = null;
|
239
251
|
|
240
|
-
this[PropertySymbol.
|
252
|
+
this[PropertySymbol.itemsByNamespaceURI].delete(
|
241
253
|
`${item[PropertySymbol.namespaceURI] || ''}:${item[PropertySymbol.localName]}`
|
242
254
|
);
|
255
|
+
this[PropertySymbol.items].delete(
|
256
|
+
`${item[PropertySymbol.namespaceURI] || ''}:${item[PropertySymbol.name]}`
|
257
|
+
);
|
243
258
|
|
244
|
-
const
|
259
|
+
const itemsByName = this[PropertySymbol.itemsByName].get(item[PropertySymbol.name]);
|
245
260
|
|
246
|
-
if (
|
247
|
-
const index =
|
261
|
+
if (itemsByName?.length) {
|
262
|
+
const index = itemsByName.indexOf(item);
|
248
263
|
if (index !== -1) {
|
249
|
-
|
264
|
+
itemsByName.splice(index, 1);
|
250
265
|
}
|
251
|
-
if (!
|
252
|
-
this[PropertySymbol.
|
266
|
+
if (!itemsByName.length) {
|
267
|
+
this[PropertySymbol.itemsByName].delete(item[PropertySymbol.name]);
|
253
268
|
}
|
254
269
|
}
|
255
270
|
|
@@ -21,7 +21,7 @@ export default class NamedNodeMapProxyFactory {
|
|
21
21
|
return new Proxy<NamedNodeMap>(namedNodeMap, {
|
22
22
|
get: (target, property) => {
|
23
23
|
if (property === 'length') {
|
24
|
-
return namedNodeMap[PropertySymbol.
|
24
|
+
return namedNodeMap[PropertySymbol.items].size;
|
25
25
|
}
|
26
26
|
if (property in target || typeof property === 'symbol') {
|
27
27
|
methodBinder.bind(property);
|
@@ -29,7 +29,7 @@ export default class NamedNodeMapProxyFactory {
|
|
29
29
|
}
|
30
30
|
const index = Number(property);
|
31
31
|
if (!isNaN(index)) {
|
32
|
-
return
|
32
|
+
return target.item(index);
|
33
33
|
}
|
34
34
|
return target.getNamedItem(<string>property) || undefined;
|
35
35
|
},
|
@@ -57,8 +57,8 @@ export default class NamedNodeMapProxyFactory {
|
|
57
57
|
return true;
|
58
58
|
},
|
59
59
|
ownKeys(): string[] {
|
60
|
-
const keys = Array.from(namedNodeMap[PropertySymbol.
|
61
|
-
for (let i = 0, max = namedNodeMap[PropertySymbol.
|
60
|
+
const keys = Array.from(namedNodeMap[PropertySymbol.items].keys());
|
61
|
+
for (let i = 0, max = namedNodeMap[PropertySymbol.items].size; i < max; i++) {
|
62
62
|
keys.push(String(i));
|
63
63
|
}
|
64
64
|
return keys;
|
@@ -68,13 +68,13 @@ export default class NamedNodeMapProxyFactory {
|
|
68
68
|
return false;
|
69
69
|
}
|
70
70
|
|
71
|
-
if (property in target || namedNodeMap[PropertySymbol.
|
71
|
+
if (property in target || namedNodeMap[PropertySymbol.items].has(property)) {
|
72
72
|
return true;
|
73
73
|
}
|
74
74
|
|
75
75
|
const index = Number(property);
|
76
76
|
|
77
|
-
if (!isNaN(index) && index >= 0 && index < namedNodeMap[PropertySymbol.
|
77
|
+
if (!isNaN(index) && index >= 0 && index < namedNodeMap[PropertySymbol.items].size) {
|
78
78
|
return true;
|
79
79
|
}
|
80
80
|
|
@@ -96,21 +96,26 @@ export default class NamedNodeMapProxyFactory {
|
|
96
96
|
}
|
97
97
|
|
98
98
|
const index = Number(property);
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
99
|
+
if (!isNaN(index)) {
|
100
|
+
if (index >= 0) {
|
101
|
+
const itemByIndex = target.item(index);
|
102
|
+
if (itemByIndex) {
|
103
|
+
return {
|
104
|
+
value: itemByIndex,
|
105
|
+
writable: false,
|
106
|
+
enumerable: true,
|
107
|
+
configurable: true
|
108
|
+
};
|
109
|
+
}
|
110
|
+
}
|
111
|
+
return;
|
107
112
|
}
|
108
113
|
|
109
|
-
const
|
114
|
+
const items = namedNodeMap[PropertySymbol.items].get(<string>property);
|
110
115
|
|
111
|
-
if (
|
116
|
+
if (items) {
|
112
117
|
return {
|
113
|
-
value:
|
118
|
+
value: items,
|
114
119
|
writable: false,
|
115
120
|
enumerable: true,
|
116
121
|
configurable: true
|
@@ -649,14 +649,14 @@ export default class HTMLElement extends Element {
|
|
649
649
|
newElement[PropertySymbol.isValue] = this[PropertySymbol.isValue];
|
650
650
|
newElement[PropertySymbol.cache] = this[PropertySymbol.cache];
|
651
651
|
newElement[PropertySymbol.affectsCache] = this[PropertySymbol.affectsCache];
|
652
|
-
newElement[PropertySymbol.attributes][PropertySymbol.
|
653
|
-
this[PropertySymbol.attributes][PropertySymbol.
|
654
|
-
newElement[PropertySymbol.attributes][PropertySymbol.
|
655
|
-
this[PropertySymbol.attributes][PropertySymbol.
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
].values()) {
|
652
|
+
newElement[PropertySymbol.attributes][PropertySymbol.itemsByNamespaceURI] =
|
653
|
+
this[PropertySymbol.attributes][PropertySymbol.itemsByNamespaceURI];
|
654
|
+
newElement[PropertySymbol.attributes][PropertySymbol.itemsByName] =
|
655
|
+
this[PropertySymbol.attributes][PropertySymbol.itemsByName];
|
656
|
+
newElement[PropertySymbol.attributes][PropertySymbol.items] =
|
657
|
+
this[PropertySymbol.attributes][PropertySymbol.items];
|
658
|
+
|
659
|
+
for (const attr of newElement[PropertySymbol.attributes][PropertySymbol.items].values()) {
|
660
660
|
attr[PropertySymbol.ownerElement] = newElement;
|
661
661
|
}
|
662
662
|
|
@@ -677,8 +677,9 @@ export default class HTMLElement extends Element {
|
|
677
677
|
this[PropertySymbol.isValue] = null;
|
678
678
|
this[PropertySymbol.cache] = newCache;
|
679
679
|
this[PropertySymbol.affectsCache] = [];
|
680
|
-
this[PropertySymbol.attributes][PropertySymbol.
|
681
|
-
this[PropertySymbol.attributes][PropertySymbol.
|
680
|
+
this[PropertySymbol.attributes][PropertySymbol.itemsByNamespaceURI] = new Map();
|
681
|
+
this[PropertySymbol.attributes][PropertySymbol.itemsByName] = new Map();
|
682
|
+
this[PropertySymbol.attributes][PropertySymbol.items] = new Map();
|
682
683
|
|
683
684
|
for (const node of newElement[PropertySymbol.nodeArray]) {
|
684
685
|
node[PropertySymbol.parentNode] = newElement;
|
package/src/nodes/node/Node.ts
CHANGED
@@ -1102,13 +1102,13 @@ export default class Node extends EventTarget {
|
|
1102
1102
|
/**
|
1103
1103
|
* 5.2.1. For each attr in node2’s attribute list:
|
1104
1104
|
*/
|
1105
|
-
for (const
|
1106
|
-
|
1107
|
-
)) {
|
1105
|
+
for (const attribute of (<Element>node2)[PropertySymbol.attributes][
|
1106
|
+
PropertySymbol.items
|
1107
|
+
].values()) {
|
1108
1108
|
/**
|
1109
1109
|
* 5.2.1.1. If attr equals attr1, then return the result of adding DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and DOCUMENT_POSITION_PRECEDING.
|
1110
1110
|
*/
|
1111
|
-
if (NodeUtility.isEqualNode(
|
1111
|
+
if (NodeUtility.isEqualNode(attribute, attr1)) {
|
1112
1112
|
return (
|
1113
1113
|
Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | Node.DOCUMENT_POSITION_PRECEDING
|
1114
1114
|
);
|
@@ -1117,7 +1117,7 @@ export default class Node extends EventTarget {
|
|
1117
1117
|
/**
|
1118
1118
|
* 5.2.1.2. If attr equals attr2, then return the result of adding DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and DOCUMENT_POSITION_FOLLOWING.
|
1119
1119
|
*/
|
1120
|
-
if (NodeUtility.isEqualNode(
|
1120
|
+
if (NodeUtility.isEqualNode(attribute, attr2)) {
|
1121
1121
|
return (
|
1122
1122
|
Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | Node.DOCUMENT_POSITION_FOLLOWING
|
1123
1123
|
);
|
@@ -200,19 +200,18 @@ export default class NodeUtility {
|
|
200
200
|
*/
|
201
201
|
public static attributeListsEqual(elementA: Element, elementB: Element): boolean {
|
202
202
|
const attributesA = Array.from(
|
203
|
-
elementA[PropertySymbol.attributes][PropertySymbol.
|
203
|
+
elementA[PropertySymbol.attributes][PropertySymbol.items].values()
|
204
204
|
);
|
205
205
|
const attributesB = Array.from(
|
206
|
-
elementB[PropertySymbol.attributes][PropertySymbol.
|
206
|
+
elementB[PropertySymbol.attributes][PropertySymbol.items].values()
|
207
207
|
);
|
208
208
|
for (const attributeA of attributesA) {
|
209
209
|
let found = false;
|
210
210
|
for (const attributeB of attributesB) {
|
211
211
|
if (
|
212
|
-
attributeA[
|
213
|
-
|
214
|
-
attributeA[
|
215
|
-
attributeA[0][PropertySymbol.value] === attributeB[0][PropertySymbol.value]
|
212
|
+
attributeA[PropertySymbol.namespaceURI] === attributeB[PropertySymbol.namespaceURI] &&
|
213
|
+
attributeA.localName === attributeB.localName &&
|
214
|
+
attributeA[PropertySymbol.value] === attributeB[PropertySymbol.value]
|
216
215
|
) {
|
217
216
|
found = true;
|
218
217
|
break;
|
@@ -258,8 +257,8 @@ export default class NodeUtility {
|
|
258
257
|
elementA[PropertySymbol.namespaceURI] !== elementB[PropertySymbol.namespaceURI] ||
|
259
258
|
elementA[PropertySymbol.prefix] !== elementB[PropertySymbol.prefix] ||
|
260
259
|
elementA[PropertySymbol.localName] !== elementB[PropertySymbol.localName] ||
|
261
|
-
elementA[PropertySymbol.attributes][PropertySymbol.
|
262
|
-
elementB[PropertySymbol.attributes][PropertySymbol.
|
260
|
+
elementA[PropertySymbol.attributes][PropertySymbol.items].size !==
|
261
|
+
elementB[PropertySymbol.attributes][PropertySymbol.items].size
|
263
262
|
) {
|
264
263
|
return false;
|
265
264
|
}
|
@@ -533,8 +533,8 @@ export default class XMLParser {
|
|
533
533
|
);
|
534
534
|
this.nextElement[PropertySymbol.attributes] = attributes;
|
535
535
|
attributes[PropertySymbol.ownerElement] = this.nextElement;
|
536
|
-
for (const
|
537
|
-
|
536
|
+
for (const item of attributes[PropertySymbol.items].values()) {
|
537
|
+
item[PropertySymbol.ownerElement] = this.nextElement;
|
538
538
|
}
|
539
539
|
} else {
|
540
540
|
this.nextElement[PropertySymbol.namespaceURI] = value;
|
@@ -140,17 +140,15 @@ export default class XMLSerializer {
|
|
140
140
|
inheritedNamespacePrefixes: Map<string, string> | null
|
141
141
|
): Map<string, string> | null {
|
142
142
|
const namespacePrefixes = new Map<string, string>(inheritedNamespacePrefixes);
|
143
|
-
const namedItems = (<Element>element)[PropertySymbol.attributes][PropertySymbol.namedItems];
|
144
143
|
|
145
|
-
for (const
|
144
|
+
for (const attribute of (<Element>element)[PropertySymbol.attributes][
|
145
|
+
PropertySymbol.items
|
146
|
+
].values()) {
|
146
147
|
if (
|
147
|
-
|
148
|
-
|
148
|
+
attribute[PropertySymbol.namespaceURI] === NamespaceURI.xmlns &&
|
149
|
+
attribute[PropertySymbol.prefix]
|
149
150
|
) {
|
150
|
-
namespacePrefixes.set(
|
151
|
-
attributes[0][PropertySymbol.value],
|
152
|
-
attributes[0][PropertySymbol.localName]
|
153
|
-
);
|
151
|
+
namespacePrefixes.set(attribute[PropertySymbol.value], attribute[PropertySymbol.localName]);
|
154
152
|
}
|
155
153
|
}
|
156
154
|
|
@@ -216,12 +214,11 @@ export default class XMLSerializer {
|
|
216
214
|
let attributeString = '';
|
217
215
|
let namespaceString = '';
|
218
216
|
|
219
|
-
const namedItems = (<Element>element)[PropertySymbol.attributes][PropertySymbol.namedItems];
|
220
217
|
const handledNamespaces = new Set();
|
221
218
|
|
222
|
-
for (const
|
223
|
-
|
224
|
-
|
219
|
+
for (const attribute of (<Element>element)[PropertySymbol.attributes][
|
220
|
+
PropertySymbol.items
|
221
|
+
].values()) {
|
225
222
|
// Namespace attributes should be in the beginning of the string.
|
226
223
|
if (attribute[PropertySymbol.namespaceURI] === NamespaceURI.xmlns) {
|
227
224
|
if (
|