@xmldom/xmldom 0.8.2 → 0.8.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/CHANGELOG.md +16 -8
- package/lib/dom.js +14 -10
- package/lib/sax.js +16 -6
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.8.3](https://github.com/xmldom/xmldom/compare/0.8.3...0.8.2)
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Avoid iterating over prototype properties [`#437`](https://github.com/xmldom/xmldom/pull/437) / [`#436`](https://github.com/xmldom/xmldom/issues/436)
|
|
11
|
+
|
|
12
|
+
Thank you, [@Supraja9726](https://github.com/Supraja9726) for your contributions
|
|
13
|
+
|
|
14
|
+
|
|
7
15
|
## [0.8.2](https://github.com/xmldom/xmldom/compare/0.8.1...0.8.2)
|
|
8
16
|
|
|
9
17
|
### Fixed
|
|
@@ -59,7 +67,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
|
|
|
59
67
|
### Fixes:
|
|
60
68
|
|
|
61
69
|
- Preserve default namespace when serializing [`#319`](https://github.com/xmldom/xmldom/issues/319) / [`#321`](https://github.com/xmldom/xmldom/pull/321)
|
|
62
|
-
Thank you [@lupestro](https://github.com/lupestro)
|
|
70
|
+
Thank you, [@lupestro](https://github.com/lupestro)
|
|
63
71
|
|
|
64
72
|
## 0.7.4
|
|
65
73
|
|
|
@@ -68,7 +76,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
|
|
|
68
76
|
### Fixes:
|
|
69
77
|
|
|
70
78
|
- Restore ability to parse `__prototype__` attributes [`#315`](https://github.com/xmldom/xmldom/pull/315)
|
|
71
|
-
Thank you [@dsimpsonOMF](https://github.com/dsimpsonOMF)
|
|
79
|
+
Thank you, [@dsimpsonOMF](https://github.com/dsimpsonOMF)
|
|
72
80
|
|
|
73
81
|
## 0.7.3
|
|
74
82
|
|
|
@@ -78,7 +86,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
|
|
|
78
86
|
|
|
79
87
|
- Add doctype when parsing from string [`#277`](https://github.com/xmldom/xmldom/issues/277) / [`#301`](https://github.com/xmldom/xmldom/pull/301)
|
|
80
88
|
- Correct typo in error message [`#294`](https://github.com/xmldom/xmldom/pull/294)
|
|
81
|
-
Thank you [@rrthomas](https://github.com/rrthomas)
|
|
89
|
+
Thank you, [@rrthomas](https://github.com/rrthomas)
|
|
82
90
|
|
|
83
91
|
### Refactor:
|
|
84
92
|
|
|
@@ -103,7 +111,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
|
|
|
103
111
|
### Fixes:
|
|
104
112
|
|
|
105
113
|
- Types: Add index.d.ts to packaged files [`#288`](https://github.com/xmldom/xmldom/pull/288)
|
|
106
|
-
Thank you [@forty](https://github.com/forty)
|
|
114
|
+
Thank you, [@forty](https://github.com/forty)
|
|
107
115
|
|
|
108
116
|
## 0.7.1
|
|
109
117
|
|
|
@@ -112,7 +120,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
|
|
|
112
120
|
### Fixes:
|
|
113
121
|
|
|
114
122
|
- Types: Copy types from DefinitelyTyped [`#283`](https://github.com/xmldom/xmldom/pull/283)
|
|
115
|
-
Thank you [@kachkaev](https://github.com/kachkaev)
|
|
123
|
+
Thank you, [@kachkaev](https://github.com/kachkaev)
|
|
116
124
|
|
|
117
125
|
### Chore:
|
|
118
126
|
- package.json: remove author, maintainers, etc. [`#279`](https://github.com/xmldom/xmldom/pull/279)
|
|
@@ -129,7 +137,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
|
|
|
129
137
|
### Fixes:
|
|
130
138
|
|
|
131
139
|
- Security: Misinterpretation of malicious XML input [`CVE-2021-32796`](https://github.com/xmldom/xmldom/security/advisories/GHSA-5fg8-2547-mr8q)
|
|
132
|
-
- Implement `Document.getElementsByClassName` as specified [`#213`](https://github.com/xmldom/xmldom/pull/213), thank you [@ChALkeR](https://github.com/ChALkeR)
|
|
140
|
+
- Implement `Document.getElementsByClassName` as specified [`#213`](https://github.com/xmldom/xmldom/pull/213), thank you, [@ChALkeR](https://github.com/ChALkeR)
|
|
133
141
|
- Inherit namespace prefix from parent when required [`#268`](https://github.com/xmldom/xmldom/pull/268)
|
|
134
142
|
- Handle whitespace in closing tags [`#267`](https://github.com/xmldom/xmldom/pull/267)
|
|
135
143
|
- Update `DOMImplementation` according to recent specs [`#210`](https://github.com/xmldom/xmldom/pull/210)
|
|
@@ -137,7 +145,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
|
|
|
137
145
|
- No longer serializes any namespaces with an empty URI [`#244`](https://github.com/xmldom/xmldom/pull/244)
|
|
138
146
|
(related to [`#168`](https://github.com/xmldom/xmldom/pull/168) released in 0.6.0)
|
|
139
147
|
BREAKING CHANGE: Only if you rely on ["unsetting" a namespace prefix](https://github.com/xmldom/xmldom/pull/168#issuecomment-886984994) by setting it to an empty string
|
|
140
|
-
- Set `localName` as part of `Document.createElement` [`#229`](https://github.com/xmldom/xmldom/pull/229), thank you [@rrthomas](https://github.com/rrthomas)
|
|
148
|
+
- Set `localName` as part of `Document.createElement` [`#229`](https://github.com/xmldom/xmldom/pull/229), thank you, [@rrthomas](https://github.com/rrthomas)
|
|
141
149
|
|
|
142
150
|
### CI
|
|
143
151
|
|
|
@@ -156,7 +164,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
|
|
|
156
164
|
|
|
157
165
|
- Stop serializing empty namespace values like `xmlns:ds=""` [`#168`](https://github.com/xmldom/xmldom/pull/168)
|
|
158
166
|
BREAKING CHANGE: If your code expected empty namespaces attributes to be serialized.
|
|
159
|
-
Thank you [@pdecat](https://github.com/pdecat) and [@FranckDepoortere](https://github.com/FranckDepoortere)
|
|
167
|
+
Thank you, [@pdecat](https://github.com/pdecat) and [@FranckDepoortere](https://github.com/FranckDepoortere)
|
|
160
168
|
- Escape `<` to `<` when serializing attribute values [`#198`](https://github.com/xmldom/xmldom/issues/198) / [`#199`](https://github.com/xmldom/xmldom/pull/199)
|
|
161
169
|
|
|
162
170
|
## 0.5.0
|
package/lib/dom.js
CHANGED
|
@@ -62,7 +62,9 @@ function arrayIncludes (list) {
|
|
|
62
62
|
|
|
63
63
|
function copy(src,dest){
|
|
64
64
|
for(var p in src){
|
|
65
|
-
|
|
65
|
+
if (Object.prototype.hasOwnProperty.call(src, p)) {
|
|
66
|
+
dest[p] = src[p];
|
|
67
|
+
}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -509,9 +511,9 @@ Node.prototype = {
|
|
|
509
511
|
//console.dir(map)
|
|
510
512
|
if(map){
|
|
511
513
|
for(var n in map){
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
514
|
+
if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
|
|
515
|
+
return n;
|
|
516
|
+
}
|
|
515
517
|
}
|
|
516
518
|
}
|
|
517
519
|
el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
|
|
@@ -525,7 +527,7 @@ Node.prototype = {
|
|
|
525
527
|
var map = el._nsMap;
|
|
526
528
|
//console.dir(map)
|
|
527
529
|
if(map){
|
|
528
|
-
if(prefix
|
|
530
|
+
if(Object.prototype.hasOwnProperty.call(map, prefix)){
|
|
529
531
|
return map[prefix] ;
|
|
530
532
|
}
|
|
531
533
|
}
|
|
@@ -1424,11 +1426,13 @@ function importNode(doc,node,deep){
|
|
|
1424
1426
|
// attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
|
|
1425
1427
|
function cloneNode(doc,node,deep){
|
|
1426
1428
|
var node2 = new node.constructor();
|
|
1427
|
-
for(var n in node){
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
if(v !=
|
|
1431
|
-
node2[n]
|
|
1429
|
+
for (var n in node) {
|
|
1430
|
+
if (Object.prototype.hasOwnProperty.call(node, n)) {
|
|
1431
|
+
var v = node[n];
|
|
1432
|
+
if (typeof v != "object") {
|
|
1433
|
+
if (v != node2[n]) {
|
|
1434
|
+
node2[n] = v;
|
|
1435
|
+
}
|
|
1432
1436
|
}
|
|
1433
1437
|
}
|
|
1434
1438
|
}
|
package/lib/sax.js
CHANGED
|
@@ -135,8 +135,10 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
|
|
135
135
|
if(endIgnoreCaseMach){
|
|
136
136
|
domBuilder.endElement(config.uri,config.localName,tagName);
|
|
137
137
|
if(localNSMap){
|
|
138
|
-
for(var prefix in localNSMap){
|
|
139
|
-
|
|
138
|
+
for (var prefix in localNSMap) {
|
|
139
|
+
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
|
|
140
|
+
domBuilder.endPrefixMapping(prefix);
|
|
141
|
+
}
|
|
140
142
|
}
|
|
141
143
|
}
|
|
142
144
|
if(!endMatch){
|
|
@@ -478,8 +480,10 @@ function appendElement(el,domBuilder,currentNSMap){
|
|
|
478
480
|
if(el.closed){
|
|
479
481
|
domBuilder.endElement(ns,localName,tagName);
|
|
480
482
|
if(localNSMap){
|
|
481
|
-
for(prefix in localNSMap){
|
|
482
|
-
|
|
483
|
+
for (prefix in localNSMap) {
|
|
484
|
+
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
|
|
485
|
+
domBuilder.endPrefixMapping(prefix);
|
|
486
|
+
}
|
|
483
487
|
}
|
|
484
488
|
}
|
|
485
489
|
}else{
|
|
@@ -525,9 +529,15 @@ function fixSelfClosed(source,elStartEnd,tagName,closeMap){
|
|
|
525
529
|
return pos<elStartEnd;
|
|
526
530
|
//}
|
|
527
531
|
}
|
|
528
|
-
|
|
529
|
-
|
|
532
|
+
|
|
533
|
+
function _copy (source, target) {
|
|
534
|
+
for (var n in source) {
|
|
535
|
+
if (Object.prototype.hasOwnProperty.call(source, n)) {
|
|
536
|
+
target[n] = source[n];
|
|
537
|
+
}
|
|
538
|
+
}
|
|
530
539
|
}
|
|
540
|
+
|
|
531
541
|
function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
|
|
532
542
|
var next= source.charAt(start+2)
|
|
533
543
|
switch(next){
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmldom/xmldom",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"w3c",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@stryker-mutator/core": "5.6.1",
|
|
46
46
|
"auto-changelog": "2.4.0",
|
|
47
|
-
"eslint": "8.
|
|
47
|
+
"eslint": "8.25.0",
|
|
48
48
|
"eslint-config-prettier": "8.5.0",
|
|
49
49
|
"eslint-plugin-es5": "1.5.0",
|
|
50
|
-
"eslint-plugin-prettier": "4.
|
|
50
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
51
51
|
"get-stream": "6.0.1",
|
|
52
52
|
"jest": "27.5.1",
|
|
53
|
-
"nodemon": "2.0.
|
|
54
|
-
"np": "7.6.
|
|
55
|
-
"prettier": "2.
|
|
53
|
+
"nodemon": "2.0.20",
|
|
54
|
+
"np": "7.6.2",
|
|
55
|
+
"prettier": "2.7.1",
|
|
56
56
|
"xmltest": "1.5.0",
|
|
57
57
|
"yauzl": "2.10.0"
|
|
58
58
|
},
|