@xmldom/xmldom 0.7.5 → 0.7.6

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 CHANGED
@@ -4,6 +4,13 @@ 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.7.6](https://github.com/xmldom/xmldom/compare/0.7.5...0.7.6)
8
+
9
+ ### Fixed
10
+ - Avoid iterating over prototype properties [`#441`](https://github.com/xmldom/xmldom/pull/441) / [`#437`](https://github.com/xmldom/xmldom/pull/437) / [`#436`](https://github.com/xmldom/xmldom/issues/436)
11
+
12
+ Thank you, [@jftanner](https://github.com/jftanner), [@Supraja9726](https://github.com/Supraja9726) for your contributions
13
+
7
14
  ## 0.7.5
8
15
 
9
16
  [Commits](https://github.com/xmldom/xmldom/compare/0.7.4...0.7.5)
@@ -11,7 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
11
18
  ### Fixes:
12
19
 
13
20
  - Preserve default namespace when serializing [`#319`](https://github.com/xmldom/xmldom/issues/319) / [`#321`](https://github.com/xmldom/xmldom/pull/321)
14
- Thank you [@lupestro](https://github.com/lupestro)
21
+ Thank you, [@lupestro](https://github.com/lupestro)
15
22
 
16
23
  ## 0.7.4
17
24
 
@@ -20,7 +27,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
20
27
  ### Fixes:
21
28
 
22
29
  - Restore ability to parse `__prototype__` attributes [`#315`](https://github.com/xmldom/xmldom/pull/315)
23
- Thank you [@dsimsonOMF](https://github.com/dsimsonOMF)
30
+ Thank you, [@dsimpsonOMF](https://github.com/dsimpsonOMF)
24
31
 
25
32
  ## 0.7.3
26
33
 
@@ -30,7 +37,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
30
37
 
31
38
  - Add doctype when parsing from string [`#277`](https://github.com/xmldom/xmldom/issues/277) / [`#301`](https://github.com/xmldom/xmldom/pull/301)
32
39
  - Correct typo in error message [`#294`](https://github.com/xmldom/xmldom/pull/294)
33
- Thank you [@rrthomas](https://github.com/rrthomas)
40
+ Thank you, [@rrthomas](https://github.com/rrthomas)
34
41
 
35
42
  ### Refactor:
36
43
 
@@ -55,7 +62,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
55
62
  ### Fixes:
56
63
 
57
64
  - Types: Add index.d.ts to packaged files [`#288`](https://github.com/xmldom/xmldom/pull/288)
58
- Thank you [@forty](https://github.com/forty)
65
+ Thank you, [@forty](https://github.com/forty)
59
66
 
60
67
  ## 0.7.1
61
68
 
@@ -64,7 +71,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
64
71
  ### Fixes:
65
72
 
66
73
  - Types: Copy types from DefinitelyTyped [`#283`](https://github.com/xmldom/xmldom/pull/283)
67
- Thank you [@kachkaev](https://github.com/kachkaev)
74
+ Thank you, [@kachkaev](https://github.com/kachkaev)
68
75
 
69
76
  ### Chore:
70
77
  - package.json: remove author, maintainers, etc. [`#279`](https://github.com/xmldom/xmldom/pull/279)
@@ -81,7 +88,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
81
88
  ### Fixes:
82
89
 
83
90
  - Security: Misinterpretation of malicious XML input [`CVE-2021-32796`](https://github.com/xmldom/xmldom/security/advisories/GHSA-5fg8-2547-mr8q)
84
- - Implement `Document.getElementsByClassName` as specified [`#213`](https://github.com/xmldom/xmldom/pull/213), thank you [@ChALkeR](https://github.com/ChALkeR)
91
+ - Implement `Document.getElementsByClassName` as specified [`#213`](https://github.com/xmldom/xmldom/pull/213), thank you, [@ChALkeR](https://github.com/ChALkeR)
85
92
  - Inherit namespace prefix from parent when required [`#268`](https://github.com/xmldom/xmldom/pull/268)
86
93
  - Handle whitespace in closing tags [`#267`](https://github.com/xmldom/xmldom/pull/267)
87
94
  - Update `DOMImplementation` according to recent specs [`#210`](https://github.com/xmldom/xmldom/pull/210)
@@ -89,7 +96,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
89
96
  - No longer serializes any namespaces with an empty URI [`#244`](https://github.com/xmldom/xmldom/pull/244)
90
97
  (related to [`#168`](https://github.com/xmldom/xmldom/pull/168) released in 0.6.0)
91
98
  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
92
- - Set `localName` as part of `Document.createElement` [`#229`](https://github.com/xmldom/xmldom/pull/229), thank you [@rrthomas](https://github.com/rrthomas)
99
+ - Set `localName` as part of `Document.createElement` [`#229`](https://github.com/xmldom/xmldom/pull/229), thank you, [@rrthomas](https://github.com/rrthomas)
93
100
 
94
101
  ### CI
95
102
 
@@ -108,7 +115,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
108
115
 
109
116
  - Stop serializing empty namespace values like `xmlns:ds=""` [`#168`](https://github.com/xmldom/xmldom/pull/168)
110
117
  BREAKING CHANGE: If your code expected empty namespaces attributes to be serialized.
111
- Thank you [@pdecat](https://github.com/pdecat) and [@FranckDepoortere](https://github.com/FranckDepoortere)
118
+ Thank you, [@pdecat](https://github.com/pdecat) and [@FranckDepoortere](https://github.com/FranckDepoortere)
112
119
  - Escape `<` to `&lt;` when serializing attribute values [`#198`](https://github.com/xmldom/xmldom/issues/198) / [`#199`](https://github.com/xmldom/xmldom/pull/199)
113
120
 
114
121
  ## 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
- dest[p] = src[p];
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
- if(map[n] == namespaceURI){
513
- return n;
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;
@@ -526,7 +528,9 @@ Node.prototype = {
526
528
  //console.dir(map)
527
529
  if(map){
528
530
  if(prefix in map){
529
- return map[prefix] ;
531
+ if(Object.prototype.hasOwnProperty.call(map, prefix)){
532
+ return map[prefix] ;
533
+ }
530
534
  }
531
535
  }
532
536
  el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
@@ -1390,11 +1394,13 @@ function importNode(doc,node,deep){
1390
1394
  // attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
1391
1395
  function cloneNode(doc,node,deep){
1392
1396
  var node2 = new node.constructor();
1393
- for(var n in node){
1394
- var v = node[n];
1395
- if(typeof v != 'object' ){
1396
- if(v != node2[n]){
1397
- node2[n] = v;
1397
+ for (var n in node) {
1398
+ if (Object.prototype.hasOwnProperty.call(node, n)) {
1399
+ var v = node[n];
1400
+ if (typeof v != "object") {
1401
+ if (v != node2[n]) {
1402
+ node2[n] = v;
1403
+ }
1398
1404
  }
1399
1405
  }
1400
1406
  }
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
- domBuilder.endPrefixMapping(prefix) ;
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){
@@ -472,8 +474,10 @@ function appendElement(el,domBuilder,currentNSMap){
472
474
  if(el.closed){
473
475
  domBuilder.endElement(ns,localName,tagName);
474
476
  if(localNSMap){
475
- for(prefix in localNSMap){
476
- domBuilder.endPrefixMapping(prefix)
477
+ for (prefix in localNSMap) {
478
+ if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
479
+ domBuilder.endPrefixMapping(prefix);
480
+ }
477
481
  }
478
482
  }
479
483
  }else{
@@ -519,9 +523,15 @@ function fixSelfClosed(source,elStartEnd,tagName,closeMap){
519
523
  return pos<elStartEnd;
520
524
  //}
521
525
  }
522
- function _copy(source,target){
523
- for(var n in source){target[n] = source[n]}
526
+
527
+ function _copy (source, target) {
528
+ for (var n in source) {
529
+ if (Object.prototype.hasOwnProperty.call(source, n)) {
530
+ target[n] = source[n];
531
+ }
532
+ }
524
533
  }
534
+
525
535
  function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
526
536
  var next= source.charAt(start+2)
527
537
  switch(next){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmldom/xmldom",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
5
5
  "keywords": [
6
6
  "w3c",