clean up escapePercentSign (#1101)

main
Michael Fix 4 years ago committed by GitHub
parent 6a6605a234
commit a1375754f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -327,9 +327,8 @@
node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml')
return new XMLSerializer().serializeToString(node)
})
.then(function (str) {
return util.escapeXhtml(str, escapePercentSign)
})
.then(util.escapeXhtml)
.then(str => (escapePercentSign ? str.replace(/%/g, '%25') : str))
.then(function (xhtml) {
return '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + '</foreignObject>'
})
@ -552,10 +551,7 @@
return array
}
function escapeXhtml(string, escapePercentSign) {
if (escapePercentSign) {
string = string.replace(/%/g, '%25')
}
function escapeXhtml(string) {
return string.replace(/#/g, '%23').replace(/\n/g, '%0A')
}

Loading…
Cancel
Save