From d7b26ea1be6d265f15200bb8a0323177c5e84c38 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Tue, 29 May 2018 14:25:35 -0400 Subject: [PATCH] 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. --- package.json | 3 +-- src/util/svg-text-wrapper.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 14a6e4c..dc23647 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/util/svg-text-wrapper.js b/src/util/svg-text-wrapper.js index 3ad4cf5..2359e16 100644 --- a/src/util/svg-text-wrapper.js +++ b/src/util/svg-text-wrapper.js @@ -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;