mirror of
https://github.com/scratchfoundation/scratch-render.git
synced 2025-06-12 05:20:48 -04:00
Remove duplicate xml escaping
We used to write the user string directly into the svg string, but now we are setting the `.textContent` of an actual dom node, which does the escaping for us.
This commit is contained in:
parent
d9f2d14306
commit
d7b26ea1be
2 changed files with 2 additions and 4 deletions
|
@ -51,7 +51,6 @@
|
|||
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||
"webpack": "^4.8.0",
|
||||
"webpack-cli": "^2.0.15",
|
||||
"webpack-dev-server": "^3.1.4",
|
||||
"xml-escape": "1.1.0"
|
||||
"webpack-dev-server": "^3.1.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const TextWrapper = require('./text-wrapper');
|
||||
const xmlescape = require('xml-escape');
|
||||
|
||||
/**
|
||||
* Measure text by using a hidden SVG attached to the DOM.
|
||||
|
@ -118,7 +117,7 @@ class SVGTextWrapper extends TextWrapper {
|
|||
const tspanNode = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
||||
tspanNode.setAttribute('x', '0');
|
||||
tspanNode.setAttribute('dy', '1.2em');
|
||||
tspanNode.textContent = xmlescape(line);
|
||||
tspanNode.textContent = line;
|
||||
textElement.appendChild(tspanNode);
|
||||
}
|
||||
return textElement;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue