@xmldom/xmldom 0.9.0-beta.1 → 0.9.0-beta.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 CHANGED
@@ -4,6 +4,46 @@ 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.3](https://github.com/xmldom/xmldom/compare/0.9.0-beta.2...0.9.0-beta.3)
8
+
9
+ ### Fixed
10
+
11
+ - fix: Stop adding tags after incomplete closing tag [`#445`](https://github.com/xmldom/xmldom/pull/445) / [`#416`](https://github.com/xmldom/xmldom/pull/416)
12
+ BREAKING CHANGE: It no longer reports an error when parsing HTML containing incomplete closing tags, to align the behavior with the one in the browser.
13
+ BREAKING CHANGE: If your code relied on not well-formed XML to be parsed and include subsequent tags, this will no longer work.
14
+ - fix: Avoid bidirectional characters in source code [`#440`](https://github.com/xmldom/xmldom/pull/440)
15
+
16
+ ### Other
17
+
18
+ - ci: Add CodeQL scan [`#444`](https://github.com/xmldom/xmldom/pull/444)
19
+
20
+ Thank you, [@ACN-kck](https://github.com/ACN-kck), [@mgerlach](https://github.com/mgerlach) for your contributions
21
+
22
+
23
+ ## [0.7.6](https://github.com/xmldom/xmldom/compare/0.7.5...0.7.6)
24
+
25
+ ### Fixed
26
+ - 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)
27
+
28
+ Thank you, [@jftanner](https://github.com/jftanner), [@Supraja9726](https://github.com/Supraja9726) for your contributions
29
+
30
+
31
+ ## [0.8.3](https://github.com/xmldom/xmldom/compare/0.8.3...0.8.2)
32
+
33
+ ### Fixed
34
+ - Avoid iterating over prototype properties [`#437`](https://github.com/xmldom/xmldom/pull/437) / [`#436`](https://github.com/xmldom/xmldom/issues/436)
35
+
36
+ Thank you, [@Supraja9726](https://github.com/Supraja9726) for your contributions
37
+
38
+
39
+ ## [0.9.0-beta.2](https://github.com/xmldom/xmldom/compare/0.9.0-beta.1...0.9.0-beta.2)
40
+
41
+ ### Fixed
42
+ - Avoid iterating over prototype properties [`#437`](https://github.com/xmldom/xmldom/pull/437) / [`#436`](https://github.com/xmldom/xmldom/issues/436)
43
+
44
+ Thank you, [@Supraja9726](https://github.com/Supraja9726) for your contributions
45
+
46
+
7
47
  ## [0.9.0-beta.1](https://github.com/xmldom/xmldom/compare/0.8.2...0.9.0-beta.1)
8
48
 
9
49
  ### Fixed
@@ -47,6 +87,7 @@ Thank you [@weiwu-zhang](https://github.com/weiwu-zhang) for your contributions
47
87
 
48
88
  - update multiple devDependencies
49
89
 
90
+
50
91
  ## [0.8.2](https://github.com/xmldom/xmldom/compare/0.8.1...0.8.2)
51
92
 
52
93
  ### Fixed
@@ -102,7 +143,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
102
143
  ### Fixes:
103
144
 
104
145
  - 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)
146
+ Thank you, [@lupestro](https://github.com/lupestro)
106
147
 
107
148
  ## 0.7.4
108
149
 
@@ -111,7 +152,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
111
152
  ### Fixes:
112
153
 
113
154
  - Restore ability to parse `__prototype__` attributes [`#315`](https://github.com/xmldom/xmldom/pull/315)
114
- Thank you [@dsimpsonOMF](https://github.com/dsimpsonOMF)
155
+ Thank you, [@dsimpsonOMF](https://github.com/dsimpsonOMF)
115
156
 
116
157
  ## 0.7.3
117
158
 
@@ -121,7 +162,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
121
162
 
122
163
  - Add doctype when parsing from string [`#277`](https://github.com/xmldom/xmldom/issues/277) / [`#301`](https://github.com/xmldom/xmldom/pull/301)
123
164
  - Correct typo in error message [`#294`](https://github.com/xmldom/xmldom/pull/294)
124
- Thank you [@rrthomas](https://github.com/rrthomas)
165
+ Thank you, [@rrthomas](https://github.com/rrthomas)
125
166
 
126
167
  ### Refactor:
127
168
 
@@ -146,7 +187,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
146
187
  ### Fixes:
147
188
 
148
189
  - Types: Add index.d.ts to packaged files [`#288`](https://github.com/xmldom/xmldom/pull/288)
149
- Thank you [@forty](https://github.com/forty)
190
+ Thank you, [@forty](https://github.com/forty)
150
191
 
151
192
  ## 0.7.1
152
193
 
@@ -155,7 +196,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
155
196
  ### Fixes:
156
197
 
157
198
  - Types: Copy types from DefinitelyTyped [`#283`](https://github.com/xmldom/xmldom/pull/283)
158
- Thank you [@kachkaev](https://github.com/kachkaev)
199
+ Thank you, [@kachkaev](https://github.com/kachkaev)
159
200
 
160
201
  ### Chore:
161
202
  - package.json: remove author, maintainers, etc. [`#279`](https://github.com/xmldom/xmldom/pull/279)
@@ -172,7 +213,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
172
213
  ### Fixes:
173
214
 
174
215
  - 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)
216
+ - Implement `Document.getElementsByClassName` as specified [`#213`](https://github.com/xmldom/xmldom/pull/213), thank you, [@ChALkeR](https://github.com/ChALkeR)
176
217
  - Inherit namespace prefix from parent when required [`#268`](https://github.com/xmldom/xmldom/pull/268)
177
218
  - Handle whitespace in closing tags [`#267`](https://github.com/xmldom/xmldom/pull/267)
178
219
  - Update `DOMImplementation` according to recent specs [`#210`](https://github.com/xmldom/xmldom/pull/210)
@@ -180,7 +221,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
180
221
  - No longer serializes any namespaces with an empty URI [`#244`](https://github.com/xmldom/xmldom/pull/244)
181
222
  (related to [`#168`](https://github.com/xmldom/xmldom/pull/168) released in 0.6.0)
182
223
  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)
224
+ - Set `localName` as part of `Document.createElement` [`#229`](https://github.com/xmldom/xmldom/pull/229), thank you, [@rrthomas](https://github.com/rrthomas)
184
225
 
185
226
  ### CI
186
227
 
@@ -199,7 +240,7 @@ For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issu
199
240
 
200
241
  - Stop serializing empty namespace values like `xmlns:ds=""` [`#168`](https://github.com/xmldom/xmldom/pull/168)
201
242
  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)
243
+ Thank you, [@pdecat](https://github.com/pdecat) and [@FranckDepoortere](https://github.com/FranckDepoortere)
203
244
  - Escape `<` to `&lt;` when serializing attribute values [`#198`](https://github.com/xmldom/xmldom/issues/198) / [`#199`](https://github.com/xmldom/xmldom/pull/199)
204
245
 
205
246
  ## 0.5.0
package/SECURITY.md CHANGED
@@ -6,20 +6,20 @@ The most up-to-date version of this document can be found at <https://github.com
6
6
 
7
7
  This repository contains the code for the libraries `xmldom` and `@xmldom/xmldom` on npm.
8
8
 
9
- As long as we didn't publish v1, we aim to maintain the last two minor versions with security fixes. If it is possible we provide security fixes as path versions.
10
- If you think there is a good reason to also patch an earlier version let us know in a github issue or the release discussion once the fix has been provided.
11
- The maintainers will consider it and if we agree and have/find the required resources, a patch for that version will be provided.
9
+ As long as we didn't publish v1, we aim to maintain the last two minor versions with security fixes. If it is possible we provide security fixes as patch versions.
10
+ If you think there is a good reason to also patch an earlier version, let us know in a GitHub issue or the release discussion once the fix has been provided.
11
+ The maintainers will consider it, and if we agree and have/find the required resources, a patch for that version will be provided.
12
12
 
13
13
  Please notice that [we are no longer able to publish the (unscoped) `xmldom` package](https://github.com/xmldom/xmldom/issues/271),
14
14
  and that all existing versions of `xmldom` are affected by at least one security vulnerability and should be considered deprecated.
15
15
  You can still report issues regarding `xmldom` as described below.
16
16
 
17
- If you need help with migrating from `xmldom` to `@xmldom/xmldom`, file a github issue or PR in the affected repository and mention @karfau.
17
+ If you need help with migrating from `xmldom` to `@xmldom/xmldom`, file a GitHub issue or PR in the affected repository and mention @karfau.
18
18
 
19
19
  ## Reporting vulnerabilities
20
20
 
21
21
  Please email reports about any security related issues you find to `security@xmldom.org`, which will forward it to the list of maintainers.
22
- The maintainers will try to respond within 7 calendar days. (If nobody peplies after 7 days, please us send a reminder!)
22
+ The maintainers will try to respond within 7 calendar days. (If nobody replies after 7 days, please us send a reminder!)
23
23
  As part of you communication please make sure to always hit "Reply all", so all maintainers are kept in the loop.
24
24
 
25
25
  In addition, please include the following information along with your report:
@@ -29,15 +29,15 @@ In addition, please include the following information along with your report:
29
29
  - An explanation who can exploit this vulnerability, and what they gain when doing so -- write an attack scenario. This will help us evaluate your report quickly, especially if the issue is complex.
30
30
  - Whether this vulnerability public or known to third parties. If it is, please provide details.
31
31
 
32
- If you believe that an existing (public) issue is security-related, please send an email to `security@xmldom.org`.
32
+ If you believe that an existing (public) issue is security-related, please email `security@xmldom.org`.
33
33
  The email should include the issue URL and a short description of why it should be handled according to this security policy.
34
34
 
35
35
  Once an issue is reported, the maintainers use the following disclosure process:
36
36
 
37
37
  - When a report is received, we confirm the issue, determine its severity and the affected versions.
38
38
  - If we know of specific third-party services or software based on xmldom that require mitigation before publication, those projects will be notified.
39
- - A [github security advisory](https://docs.github.com/en/code-security/security-advisories/about-github-security-advisories) is [created](https://docs.github.com/en/code-security/security-advisories/creating-a-security-advisory) (but not published) which details the problem and steps for mitigation.
40
- - If the reporter provides a github account and agrees to it, we (add that github account as a collaborator on the advisuory)[https://docs.github.com/en/code-security/security-advisories/adding-a-collaborator-to-a-security-advisory].
39
+ - A [GitHub security advisory](https://docs.github.com/en/code-security/security-advisories/about-github-security-advisories) is [created](https://docs.github.com/en/code-security/security-advisories/creating-a-security-advisory) (but not published) which details the problem and steps for mitigation.
40
+ - If the reporter provides a GitHub account and agrees to it, we [add that GitHub account as a collaborator on the advisory](https://docs.github.com/en/code-security/security-advisories/adding-a-collaborator-to-a-security-advisory).
41
41
  - The vulnerability is fixed in a [private fork](https://docs.github.com/en/code-security/security-advisories/collaborating-in-a-temporary-private-fork-to-resolve-a-security-vulnerability) and potential workarounds are identified.
42
42
  - The maintainers audit the existing code to find any potential similar problems.
43
43
  - The release for the current minor version and the [security advisory are published](https://docs.github.com/en/code-security/security-advisories/publishing-a-security-advisory).
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/entities.js CHANGED
@@ -30,242 +30,242 @@ exports.HTML_ENTITIES = freeze({
30
30
  amp: '&',
31
31
  quot: '"',
32
32
  apos: "'",
33
- Agrave: "À",
34
- Aacute: "Á",
35
- Acirc: "Â",
36
- Atilde: "Ã",
37
- Auml: "Ä",
38
- Aring: "Å",
39
- AElig: "Æ",
40
- Ccedil: "Ç",
41
- Egrave: "È",
42
- Eacute: "É",
43
- Ecirc: "Ê",
44
- Euml: "Ë",
45
- Igrave: "Ì",
46
- Iacute: "Í",
47
- Icirc: "Î",
48
- Iuml: "Ï",
49
- ETH: "Ð",
50
- Ntilde: "Ñ",
51
- Ograve: "Ò",
52
- Oacute: "Ó",
53
- Ocirc: "Ô",
54
- Otilde: "Õ",
55
- Ouml: "Ö",
56
- Oslash: "Ø",
57
- Ugrave: "Ù",
58
- Uacute: "Ú",
59
- Ucirc: "Û",
60
- Uuml: "Ü",
61
- Yacute: "Ý",
62
- THORN: "Þ",
63
- szlig: "ß",
64
- agrave: "à",
65
- aacute: "á",
66
- acirc: "â",
67
- atilde: "ã",
68
- auml: "ä",
69
- aring: "å",
70
- aelig: "æ",
71
- ccedil: "ç",
72
- egrave: "è",
73
- eacute: "é",
74
- ecirc: "ê",
75
- euml: "ë",
76
- igrave: "ì",
77
- iacute: "í",
78
- icirc: "î",
79
- iuml: "ï",
80
- eth: "ð",
81
- ntilde: "ñ",
82
- ograve: "ò",
83
- oacute: "ó",
84
- ocirc: "ô",
85
- otilde: "õ",
86
- ouml: "ö",
87
- oslash: "ø",
88
- ugrave: "ù",
89
- uacute: "ú",
90
- ucirc: "û",
91
- uuml: "ü",
92
- yacute: "ý",
93
- thorn: "þ",
94
- yuml: "ÿ",
33
+ Agrave: "\u00C0",
34
+ Aacute: "\u00C1",
35
+ Acirc: "\u00C2",
36
+ Atilde: "\u00C3",
37
+ Auml: "\u00C4",
38
+ Aring: "\u00C5",
39
+ AElig: "\u00C6",
40
+ Ccedil: "\u00C7",
41
+ Egrave: "\u00C8",
42
+ Eacute: "\u00C9",
43
+ Ecirc: "\u00CA",
44
+ Euml: "\u00CB",
45
+ Igrave: "\u00CC",
46
+ Iacute: "\u00CD",
47
+ Icirc: "\u00CE",
48
+ Iuml: "\u00CF",
49
+ ETH: "\u00D0",
50
+ Ntilde: "\u00D1",
51
+ Ograve: "\u00D2",
52
+ Oacute: "\u00D3",
53
+ Ocirc: "\u00D4",
54
+ Otilde: "\u00D5",
55
+ Ouml: "\u00D6",
56
+ Oslash: "\u00D8",
57
+ Ugrave: "\u00D9",
58
+ Uacute: "\u00DA",
59
+ Ucirc: "\u00DB",
60
+ Uuml: "\u00DC",
61
+ Yacute: "\u00DD",
62
+ THORN: "\u00DE",
63
+ szlig: "\u00DF",
64
+ agrave: "\u00E0",
65
+ aacute: "\u00E1",
66
+ acirc: "\u00E2",
67
+ atilde: "\u00E3",
68
+ auml: "\u00E4",
69
+ aring: "\u00E5",
70
+ aelig: "\u00E6",
71
+ ccedil: "\u00E7",
72
+ egrave: "\u00E8",
73
+ eacute: "\u00E9",
74
+ ecirc: "\u00EA",
75
+ euml: "\u00EB",
76
+ igrave: "\u00EC",
77
+ iacute: "\u00ED",
78
+ icirc: "\u00EE",
79
+ iuml: "\u00EF",
80
+ eth: "\u00F0",
81
+ ntilde: "\u00F1",
82
+ ograve: "\u00F2",
83
+ oacute: "\u00F3",
84
+ ocirc: "\u00F4",
85
+ otilde: "\u00F5",
86
+ ouml: "\u00F6",
87
+ oslash: "\u00F8",
88
+ ugrave: "\u00F9",
89
+ uacute: "\u00FA",
90
+ ucirc: "\u00FB",
91
+ uuml: "\u00FC",
92
+ yacute: "\u00FD",
93
+ thorn: "\u00FE",
94
+ yuml: "\u00FF",
95
95
  nbsp: "\u00a0",
96
- iexcl: "¡",
97
- cent: "¢",
98
- pound: "£",
99
- curren: "¤",
100
- yen: "¥",
101
- brvbar: "¦",
102
- sect: "§",
103
- uml: "¨",
104
- copy: "©",
105
- ordf: "ª",
106
- laquo: "«",
107
- not: "¬",
108
- shy: "­­",
109
- reg: "®",
110
- macr: "¯",
111
- deg: "°",
112
- plusmn: "±",
113
- sup2: "²",
114
- sup3: "³",
115
- acute: "´",
116
- micro: "µ",
117
- para: "",
118
- middot: "·",
119
- cedil: "¸",
120
- sup1: "¹",
121
- ordm: "º",
122
- raquo: "»",
123
- frac14: "¼",
124
- frac12: "½",
125
- frac34: "¾",
126
- iquest: "¿",
127
- times: "×",
128
- divide: "÷",
129
- forall: "",
130
- part: "",
131
- exist: "",
132
- empty: "",
133
- nabla: "",
134
- isin: "",
135
- notin: "",
136
- ni: "",
137
- prod: "",
138
- sum: "",
139
- minus: "",
140
- lowast: "",
141
- radic: "",
142
- prop: "",
143
- infin: "",
144
- ang: "",
145
- and: "",
146
- or: "",
147
- cap: "",
148
- cup: "",
149
- 'int': "",
150
- there4: "",
151
- sim: "",
152
- cong: "",
153
- asymp: "",
154
- ne: "",
155
- equiv: "",
156
- le: "",
157
- ge: "",
158
- sub: "",
159
- sup: "",
160
- nsub: "",
161
- sube: "",
162
- supe: "",
163
- oplus: "",
164
- otimes: "",
165
- perp: "",
166
- sdot: "",
167
- Alpha: "Α",
168
- Beta: "Β",
169
- Gamma: "Γ",
170
- Delta: "Δ",
171
- Epsilon: "Ε",
172
- Zeta: "Ζ",
173
- Eta: "Η",
174
- Theta: "Θ",
175
- Iota: "Ι",
176
- Kappa: "Κ",
177
- Lambda: "Λ",
178
- Mu: "Μ",
179
- Nu: "Ν",
180
- Xi: "Ξ",
181
- Omicron: "Ο",
182
- Pi: "Π",
183
- Rho: "Ρ",
184
- Sigma: "Σ",
185
- Tau: "Τ",
186
- Upsilon: "Υ",
187
- Phi: "Φ",
188
- Chi: "Χ",
189
- Psi: "Ψ",
190
- Omega: "Ω",
191
- alpha: "α",
192
- beta: "β",
193
- gamma: "γ",
194
- delta: "δ",
195
- epsilon: "ε",
196
- zeta: "ζ",
197
- eta: "η",
198
- theta: "θ",
199
- iota: "ι",
200
- kappa: "κ",
201
- lambda: "λ",
202
- mu: "μ",
203
- nu: "ν",
204
- xi: "ξ",
205
- omicron: "ο",
206
- pi: "π",
207
- rho: "ρ",
208
- sigmaf: "ς",
209
- sigma: "σ",
210
- tau: "τ",
211
- upsilon: "υ",
212
- phi: "φ",
213
- chi: "χ",
214
- psi: "ψ",
215
- omega: "ω",
216
- thetasym: "ϑ",
217
- upsih: "ϒ",
218
- piv: "ϖ",
219
- OElig: "Œ",
220
- oelig: "œ",
221
- Scaron: "Š",
222
- scaron: "š",
223
- Yuml: "Ÿ",
224
- fnof: "ƒ",
225
- circ: "ˆ",
226
- tilde: "˜",
227
- ensp: "",
228
- emsp: "",
229
- thinsp: "",
230
- zwnj: "",
231
- zwj: "",
232
- lrm: "",
233
- rlm: "",
234
- ndash: "",
235
- mdash: "",
236
- lsquo: "",
237
- rsquo: "",
238
- sbquo: "",
239
- ldquo: "",
240
- rdquo: "",
241
- bdquo: "",
242
- dagger: "",
243
- Dagger: "",
244
- bull: "",
245
- hellip: "",
246
- permil: "",
247
- prime: "",
248
- Prime: "",
249
- lsaquo: "",
250
- rsaquo: "",
251
- oline: "",
252
- euro: "",
253
- trade: "",
254
- larr: "",
255
- uarr: "",
256
- rarr: "",
257
- darr: "",
258
- harr: "",
259
- crarr: "",
260
- lceil: "",
261
- rceil: "",
262
- lfloor: "",
263
- rfloor: "",
264
- loz: "",
265
- spades: "",
266
- clubs: "",
267
- hearts: "",
268
- diams: ""
96
+ iexcl: "\u00A1",
97
+ cent: "\u00A2",
98
+ pound: "\u00A3",
99
+ curren: "\u00A4",
100
+ yen: "\u00A5",
101
+ brvbar: "\u00A6",
102
+ sect: "\u00A7",
103
+ uml: "\u00A8",
104
+ copy: "\u00A9",
105
+ ordf: "\u00AA",
106
+ laquo: "\u00AB",
107
+ not: "\u00AC",
108
+ shy: "\u00AD",
109
+ reg: "\u00AE",
110
+ macr: "\u00AF",
111
+ deg: "\u00B0",
112
+ plusmn: "\u00B1",
113
+ sup2: "\u00B2",
114
+ sup3: "\u00B3",
115
+ acute: "\u00B4",
116
+ micro: "\u00B5",
117
+ para: "\u00B6",
118
+ middot: "\u00B7",
119
+ cedil: "\u00B8",
120
+ sup1: "\u00B9",
121
+ ordm: "\u00BA",
122
+ raquo: "\u00BB",
123
+ frac14: "\u00BC",
124
+ frac12: "\u00BD",
125
+ frac34: "\u00BE",
126
+ iquest: "\u00BF",
127
+ times: "\u00D7",
128
+ divide: "\u00F7",
129
+ forall: "\u2200",
130
+ part: "\u2202",
131
+ exist: "\u2203",
132
+ empty: "\u2205",
133
+ nabla: "\u2207",
134
+ isin: "\u2208",
135
+ notin: "\u2209",
136
+ ni: "\u220B",
137
+ prod: "\u220F",
138
+ sum: "\u2211",
139
+ minus: "\u2212",
140
+ lowast: "\u2217",
141
+ radic: "\u221A",
142
+ prop: "\u221D",
143
+ infin: "\u221E",
144
+ ang: "\u2220",
145
+ and: "\u2227",
146
+ or: "\u2228",
147
+ cap: "\u2229",
148
+ cup: "\u222A",
149
+ 'int': "\u222B",
150
+ there4: "\u2234",
151
+ sim: "\u223C",
152
+ cong: "\u2245",
153
+ asymp: "\u2248",
154
+ ne: "\u2260",
155
+ equiv: "\u2261",
156
+ le: "\u2264",
157
+ ge: "\u2265",
158
+ sub: "\u2282",
159
+ sup: "\u2283",
160
+ nsub: "\u2284",
161
+ sube: "\u2286",
162
+ supe: "\u2287",
163
+ oplus: "\u2295",
164
+ otimes: "\u2297",
165
+ perp: "\u22A5",
166
+ sdot: "\u22C5",
167
+ Alpha: "\u0391",
168
+ Beta: "\u0392",
169
+ Gamma: "\u0393",
170
+ Delta: "\u0394",
171
+ Epsilon: "\u0395",
172
+ Zeta: "\u0396",
173
+ Eta: "\u0397",
174
+ Theta: "\u0398",
175
+ Iota: "\u0399",
176
+ Kappa: "\u039A",
177
+ Lambda: "\u039B",
178
+ Mu: "\u039C",
179
+ Nu: "\u039D",
180
+ Xi: "\u039E",
181
+ Omicron: "\u039F",
182
+ Pi: "\u03A0",
183
+ Rho: "\u03A1",
184
+ Sigma: "\u03A3",
185
+ Tau: "\u03A4",
186
+ Upsilon: "\u03A5",
187
+ Phi: "\u03A6",
188
+ Chi: "\u03A7",
189
+ Psi: "\u03A8",
190
+ Omega: "\u03A9",
191
+ alpha: "\u03B1",
192
+ beta: "\u03B2",
193
+ gamma: "\u03B3",
194
+ delta: "\u03B4",
195
+ epsilon: "\u03B5",
196
+ zeta: "\u03B6",
197
+ eta: "\u03B7",
198
+ theta: "\u03B8",
199
+ iota: "\u03B9",
200
+ kappa: "\u03BA",
201
+ lambda: "\u03BB",
202
+ mu: "\u03BC",
203
+ nu: "\u03BD",
204
+ xi: "\u03BE",
205
+ omicron: "\u03BF",
206
+ pi: "\u03C0",
207
+ rho: "\u03C1",
208
+ sigmaf: "\u03C2",
209
+ sigma: "\u03C3",
210
+ tau: "\u03C4",
211
+ upsilon: "\u03C5",
212
+ phi: "\u03C6",
213
+ chi: "\u03C7",
214
+ psi: "\u03C8",
215
+ omega: "\u03C9",
216
+ thetasym: "\u03D1",
217
+ upsih: "\u03D2",
218
+ piv: "\u03D6",
219
+ OElig: "\u0152",
220
+ oelig: "\u0153",
221
+ Scaron: "\u0160",
222
+ scaron: "\u0161",
223
+ Yuml: "\u0178",
224
+ fnof: "\u0192",
225
+ circ: "\u02C6",
226
+ tilde: "\u02DC",
227
+ ensp: "\u2002",
228
+ emsp: "\u2003",
229
+ thinsp: "\u2009",
230
+ zwnj: "\u200C",
231
+ zwj: "\u200D",
232
+ lrm: "\u200E",
233
+ rlm: "\u200F",
234
+ ndash: "\u2013",
235
+ mdash: "\u2014",
236
+ lsquo: "\u2018",
237
+ rsquo: "\u2019",
238
+ sbquo: "\u201A",
239
+ ldquo: "\u201C",
240
+ rdquo: "\u201D",
241
+ bdquo: "\u201E",
242
+ dagger: "\u2020",
243
+ Dagger: "\u2021",
244
+ bull: "\u2022",
245
+ hellip: "\u2026",
246
+ permil: "\u2030",
247
+ prime: "\u2032",
248
+ Prime: "\u2033",
249
+ lsaquo: "\u2039",
250
+ rsaquo: "\u203A",
251
+ oline: "\u203E",
252
+ euro: "\u20AC",
253
+ trade: "\u2122",
254
+ larr: "\u2190",
255
+ uarr: "\u2191",
256
+ rarr: "\u2192",
257
+ darr: "\u2193",
258
+ harr: "\u2194",
259
+ crarr: "\u21B5",
260
+ lceil: "\u2308",
261
+ rceil: "\u2309",
262
+ lfloor: "\u230A",
263
+ rfloor: "\u230B",
264
+ loz: "\u25CA",
265
+ spades: "\u2660",
266
+ clubs: "\u2663",
267
+ hearts: "\u2665",
268
+ diams: "\u2666"
269
269
  });
270
270
 
271
271
  /**
package/lib/sax.js CHANGED
@@ -122,19 +122,18 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
122
122
  appendText(tagStart);
123
123
  }
124
124
  switch(source.charAt(tagStart+1)){
125
- case '/':
126
- var end = source.indexOf('>',tagStart+3);
127
- var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
125
+ case '/':
128
126
  var config = parseStack.pop();
129
- if(end<0){
130
-
131
- tagName = source.substring(tagStart+2).replace(/[\s<].*/,'');
132
- errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName);
133
- end = tagStart+1+tagName.length;
134
- }else if(tagName.match(/\s</)){
135
- tagName = tagName.replace(/[\s<].*/,'');
136
- errorHandler.error("end tag name: "+tagName+' maybe not complete');
137
- end = tagStart+1+tagName.length;
127
+ var end = source.indexOf(">", tagStart + 3);
128
+ var tagNameRaw = source.substring(tagStart + 2, end > 0 ? end : undefined);
129
+ var tagNameMatch = new RegExp("(" + tagNamePattern.source.slice(0, -1) + ")").exec(tagNameRaw);
130
+ // for the root level the config does not contain the tagName
131
+ var tagName = tagNameMatch && tagNameMatch[1] ? tagNameMatch[1] : (config.tagName || domBuilder.doc.documentElement.tagName);
132
+ if (end < 0) {
133
+ errorHandler.error("end tag name: " + tagName + " is not complete");
134
+ end = tagStart + 1 + tagName.length;
135
+ } else if (tagNameRaw.match(/</) && !isHTML) {
136
+ errorHandler.error("end tag name: " + tagName + " maybe not complete");
138
137
  }
139
138
  var localNSMap = config.localNSMap;
140
139
  var endMatch = config.tagName == tagName;
@@ -142,8 +141,10 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
142
141
  if(endIgnoreCaseMach){
143
142
  domBuilder.endElement(config.uri,config.localName,tagName);
144
143
  if(localNSMap){
145
- for(var prefix in localNSMap){
146
- domBuilder.endPrefixMapping(prefix) ;
144
+ for (var prefix in localNSMap) {
145
+ if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
146
+ domBuilder.endPrefixMapping(prefix);
147
+ }
147
148
  }
148
149
  }
149
150
  if(!endMatch){
@@ -493,8 +494,10 @@ function appendElement(el,domBuilder,currentNSMap){
493
494
  if(el.closed){
494
495
  domBuilder.endElement(ns,localName,tagName);
495
496
  if(localNSMap){
496
- for(prefix in localNSMap){
497
- domBuilder.endPrefixMapping(prefix)
497
+ for (prefix in localNSMap) {
498
+ if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
499
+ domBuilder.endPrefixMapping(prefix);
500
+ }
498
501
  }
499
502
  }
500
503
  }else{
@@ -536,9 +539,15 @@ function fixSelfClosed(source,elStartEnd,tagName,closeMap){
536
539
  return pos<elStartEnd;
537
540
  //}
538
541
  }
539
- function _copy(source,target){
540
- for(var n in source){target[n] = source[n]}
542
+
543
+ function _copy (source, target) {
544
+ for (var n in source) {
545
+ if (Object.prototype.hasOwnProperty.call(source, n)) {
546
+ target[n] = source[n];
547
+ }
548
+ }
541
549
  }
550
+
542
551
  function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
543
552
  var next= source.charAt(start+2)
544
553
  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.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",
@@ -46,6 +46,7 @@
46
46
  "auto-changelog": "2.4.0",
47
47
  "eslint": "8.25.0",
48
48
  "eslint-config-prettier": "8.5.0",
49
+ "eslint-plugin-anti-trojan-source": "1.1.0",
49
50
  "eslint-plugin-es5": "1.5.0",
50
51
  "eslint-plugin-prettier": "4.2.1",
51
52
  "get-stream": "6.0.1",