Skip to content

Commit

Permalink
fix: pass through numeric character references representing < and `…
Browse files Browse the repository at this point in the history
…&` as is, as otherwise may break well-formedness; fixes svg#1
  • Loading branch information
brettz9 committed Dec 23, 2021
1 parent ef54995 commit ea607fa
Show file tree
Hide file tree
Showing 3 changed files with 9,646 additions and 2,651 deletions.
5 changes: 5 additions & 0 deletions lib/sax.js
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,11 @@
num = parseInt(entity, 10)
numStr = num.toString(10)
}
switch (num) {
case 60: // '<'
case 38: // '&'
return '&' + entityLC + ';'
}
}
entity = entity.replace(/^0+/, '')
if (isNaN(num) || numStr.toLowerCase() !== entity) {
Expand Down

0 comments on commit ea607fa

Please sign in to comment.