Skip to content

Commit d2c2834

Browse files
committed
fix: pass through numeric character references as is representing < and &, as otherwise may break well-formedness; fixes svg#1
1 parent ef54995 commit d2c2834

File tree

3 files changed

+9646
-2651
lines changed

3 files changed

+9646
-2651
lines changed

lib/sax.js

+5
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,11 @@
827827
num = parseInt(entity, 10)
828828
numStr = num.toString(10)
829829
}
830+
switch (num) {
831+
case 60: // '<'
832+
case 38: // '&'
833+
return '&' + entityLC + ';'
834+
}
830835
}
831836
entity = entity.replace(/^0+/, '')
832837
if (isNaN(num) || numStr.toLowerCase() !== entity) {

0 commit comments

Comments
 (0)