@xmldom/xmldom 0.9.0-beta.1 → 0.9.0-beta.2

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,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.9.0-beta.2](https://github.com/xmldom/xmldom/compare/0.9.0-beta.1...0.9.0-beta.2)
8
+
9
+
10
+ ### Fixed
11
+ - Avoid iterating over prototype properties [`#437`](https://github.com/xmldom/xmldom/pull/437) / [`#436`](https://github.com/xmldom/xmldom/issues/436)
12
+
13
+ Thank you, [@Supraja9726](https://github.com/Supraja9726) for your contributions
14
+
7
15
  ## [0.9.0-beta.1](https://github.com/xmldom/xmldom/compare/0.8.2...0.9.0-beta.1)
8
16
 
9
17
  ### Fixed
@@ -102,7 +110,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
102
110
  ### Fixes:
103
111
 
104
112
  - Preserve default namespace when serializing [`#319`](https://github.com/xmldom/xmldom/issues/319) / [`#321`](https://github.com/xmldom/xmldom/pull/321)
105
- Thank you [@lupestro](https://github.com/lupestro)
113
+ Thank you, [@lupestro](https://github.com/lupestro)
106
114
 
107
115
  ## 0.7.4
108
116
 
@@ -111,7 +119,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
111
119
  ### Fixes:
112
120
 
113
121
  - Restore ability to parse `__prototype__` attributes [`#315`](https://github.com/xmldom/xmldom/pull/315)
114
- Thank you [@dsimpsonOMF](https://github.com/dsimpsonOMF)
122
+ Thank you, [@dsimpsonOMF](https://github.com/dsimpsonOMF)
115
123
 
116
124
  ## 0.7.3
117
125
 
@@ -121,7 +129,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
121
129
 
122
130
  - Add doctype when parsing from string [`#277`](https://github.com/xmldom/xmldom/issues/277) / [`#301`](https://github.com/xmldom/xmldom/pull/301)
123
131
  - Correct typo in error message [`#294`](https://github.com/xmldom/xmldom/pull/294)
124
- Thank you [@rrthomas](https://github.com/rrthomas)
132
+ Thank you, [@rrthomas](https://github.com/rrthomas)
125
133
 
126
134
  ### Refactor:
127
135
 
@@ -146,7 +154,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
146
154
  ### Fixes:
147
155
 
148
156
  - Types: Add index.d.ts to packaged files [`#288`](https://github.com/xmldom/xmldom/pull/288)
149
- Thank you [@forty](https://github.com/forty)
157
+ Thank you, [@forty](https://github.com/forty)
150
158
 
151
159
  ## 0.7.1
152
160
 
@@ -155,7 +163,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
155
163
  ### Fixes:
156
164
 
157
165
  - Types: Copy types from DefinitelyTyped [`#283`](https://github.com/xmldom/xmldom/pull/283)
158
- Thank you [@kachkaev](https://github.com/kachkaev)
166
+ Thank you, [@kachkaev](https://github.com/kachkaev)
159
167
 
160
168
  ### Chore:
161
169
  - package.json: remove author, maintainers, etc. [`#279`](https://github.com/xmldom/xmldom/pull/279)
@@ -172,7 +180,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
172
180
  ### Fixes:
173
181
 
174
182
  - Security: Misinterpretation of malicious XML input [`CVE-2021-32796`](https://github.com/xmldom/xmldom/security/advisories/GHSA-5fg8-2547-mr8q)
175
- - Implement `Document.getElementsByClassName` as specified [`#213`](https://github.com/xmldom/xmldom/pull/213), thank you [@ChALkeR](https://github.com/ChALkeR)
183
+ - Implement `Document.getElementsByClassName` as specified [`#213`](https://github.com/xmldom/xmldom/pull/213), thank you, [@ChALkeR](https://github.com/ChALkeR)
176
184
  - Inherit namespace prefix from parent when required [`#268`](https://github.com/xmldom/xmldom/pull/268)
177
185
  - Handle whitespace in closing tags [`#267`](https://github.com/xmldom/xmldom/pull/267)
178
186
  - Update `DOMImplementation` according to recent specs [`#210`](https://github.com/xmldom/xmldom/pull/210)
@@ -180,7 +188,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
180
188
  - No longer serializes any namespaces with an empty URI [`#244`](https://github.com/xmldom/xmldom/pull/244)
181
189
  (related to [`#168`](https://github.com/xmldom/xmldom/pull/168) released in 0.6.0)
182
190
  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
183
- - Set `localName` as part of `Document.createElement` [`#229`](https://github.com/xmldom/xmldom/pull/229), thank you [@rrthomas](https://github.com/rrthomas)
191
+ - Set `localName` as part of `Document.createElement` [`#229`](https://github.com/xmldom/xmldom/pull/229), thank you, [@rrthomas](https://github.com/rrthomas)
184
192
 
185
193
  ### CI
186
194
 
@@ -199,7 +207,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
199
207
 
200
208
  - Stop serializing empty namespace values like `xmlns:ds=""` [`#168`](https://github.com/xmldom/xmldom/pull/168)
201
209
  BREAKING CHANGE: If your code expected empty namespaces attributes to be serialized.
202
- Thank you [@pdecat](https://github.com/pdecat) and [@FranckDepoortere](https://github.com/FranckDepoortere)
210
+ Thank you, [@pdecat](https://github.com/pdecat) and [@FranckDepoortere](https://github.com/FranckDepoortere)
203
211
  - Escape `<` to `&lt;` when serializing attribute values [`#198`](https://github.com/xmldom/xmldom/issues/198) / [`#199`](https://github.com/xmldom/xmldom/pull/199)
204
212
 
205
213
  ## 0.5.0
package/lib/dom.js CHANGED
@@ -64,7 +64,9 @@ function arrayIncludes (list) {
64
64
 
65
65
  function copy(src,dest){
66
66
  for(var p in src){
67
- dest[p] = src[p];
67
+ if (Object.prototype.hasOwnProperty.call(src, p)) {
68
+ dest[p] = src[p];
69
+ }
68
70
  }
69
71
  }
70
72
 
@@ -553,9 +555,9 @@ Node.prototype = {
553
555
  //console.dir(map)
554
556
  if(map){
555
557
  for(var n in map){
556
- if(map[n] == namespaceURI){
557
- return n;
558
- }
558
+ if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
559
+ return n;
560
+ }
559
561
  }
560
562
  }
561
563
  el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
@@ -569,7 +571,7 @@ Node.prototype = {
569
571
  var map = el._nsMap;
570
572
  //console.dir(map)
571
573
  if(map){
572
- if(prefix in map){
574
+ if(Object.prototype.hasOwnProperty.call(map, prefix)){
573
575
  return map[prefix] ;
574
576
  }
575
577
  }
@@ -1608,11 +1610,13 @@ function importNode(doc,node,deep){
1608
1610
  // attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
1609
1611
  function cloneNode(doc,node,deep){
1610
1612
  var node2 = new node.constructor();
1611
- for(var n in node){
1612
- var v = node[n];
1613
- if(typeof v != 'object' ){
1614
- if(v != node2[n]){
1615
- node2[n] = v;
1613
+ for (var n in node) {
1614
+ if (Object.prototype.hasOwnProperty.call(node, n)) {
1615
+ var v = node[n];
1616
+ if (typeof v != "object") {
1617
+ if (v != node2[n]) {
1618
+ node2[n] = v;
1619
+ }
1616
1620
  }
1617
1621
  }
1618
1622
  }
package/lib/sax.js CHANGED
@@ -142,8 +142,10 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
142
142
  if(endIgnoreCaseMach){
143
143
  domBuilder.endElement(config.uri,config.localName,tagName);
144
144
  if(localNSMap){
145
- for(var prefix in localNSMap){
146
- domBuilder.endPrefixMapping(prefix) ;
145
+ for (var prefix in localNSMap) {
146
+ if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
147
+ domBuilder.endPrefixMapping(prefix);
148
+ }
147
149
  }
148
150
  }
149
151
  if(!endMatch){
@@ -493,8 +495,10 @@ function appendElement(el,domBuilder,currentNSMap){
493
495
  if(el.closed){
494
496
  domBuilder.endElement(ns,localName,tagName);
495
497
  if(localNSMap){
496
- for(prefix in localNSMap){
497
- domBuilder.endPrefixMapping(prefix)
498
+ for (prefix in localNSMap) {
499
+ if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
500
+ domBuilder.endPrefixMapping(prefix);
501
+ }
498
502
  }
499
503
  }
500
504
  }else{
@@ -536,9 +540,15 @@ function fixSelfClosed(source,elStartEnd,tagName,closeMap){
536
540
  return pos<elStartEnd;
537
541
  //}
538
542
  }
539
- function _copy(source,target){
540
- for(var n in source){target[n] = source[n]}
543
+
544
+ function _copy (source, target) {
545
+ for (var n in source) {
546
+ if (Object.prototype.hasOwnProperty.call(source, n)) {
547
+ target[n] = source[n];
548
+ }
549
+ }
541
550
  }
551
+
542
552
  function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
543
553
  var next= source.charAt(start+2)
544
554
  switch(next){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmldom/xmldom",
3
- "version": "0.9.0-beta.1",
3
+ "version": "0.9.0-beta.2",
4
4
  "description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
5
5
  "keywords": [
6
6
  "w3c",