Merge pull request #13505 from Snuffleupagus/createMatrix-DOMSVGFactory

Use the `DOMSVGFactory`, rather than manually creating the SVG-element, in `createMatrix` (PR 13361 follow-up)
This commit is contained in:
Jonas Jenwald 2021-06-07 11:16:07 +02:00 committed by GitHub
commit e0abf87bc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ import {
unreachable, unreachable,
Util, Util,
} from "../shared/util.js"; } from "../shared/util.js";
import { DOMSVGFactory } from "./display_utils.js";
let svgElement; let svgElement;
@ -29,7 +30,8 @@ function createMatrix(matrix) {
return new DOMMatrix(matrix); return new DOMMatrix(matrix);
} }
if (!svgElement) { if (!svgElement) {
svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); const svgFactory = new DOMSVGFactory();
svgElement = svgFactory.createElement("svg");
} }
return svgElement.createSVGMatrix(matrix); return svgElement.createSVGMatrix(matrix);
} }