Merge pull request #16145 from calixteman/issue16135

Move the svg definitions in its own div
This commit is contained in:
calixteman 2023-03-10 17:45:29 +01:00 committed by GitHub
commit 4a4c5d0fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,14 +67,22 @@ class FilterFactory {
get #defs() {
if (!this.#_defs) {
const div = this.#document.createElement("div");
const { style } = div;
style.visibility = "hidden";
style.contain = "strict";
style.width = style.height = 0;
style.position = "absolute";
style.top = style.left = 0;
style.zIndex = -1;
const svg = this.#document.createElementNS(SVG_NS, "svg");
svg.setAttribute("width", 0);
svg.setAttribute("height", 0);
svg.style.visibility = "hidden";
svg.style.contain = "strict";
this.#_defs = this.#document.createElementNS(SVG_NS, "defs");
div.append(svg);
svg.append(this.#_defs);
this.#document.body.append(svg);
this.#document.body.append(div);
}
return this.#_defs;
}
@ -161,7 +169,7 @@ class FilterFactory {
destroy() {
if (this.#_defs) {
this.#_defs.parentNode.remove();
this.#_defs.parentNode.parentNode.remove();
this.#_defs = null;
}
if (this.#_cache) {