Merge pull request #16145 from calixteman/issue16135
Move the svg definitions in its own div
This commit is contained in:
commit
4a4c5d0fe2
@ -67,14 +67,22 @@ class FilterFactory {
|
|||||||
|
|
||||||
get #defs() {
|
get #defs() {
|
||||||
if (!this.#_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");
|
const svg = this.#document.createElementNS(SVG_NS, "svg");
|
||||||
svg.setAttribute("width", 0);
|
svg.setAttribute("width", 0);
|
||||||
svg.setAttribute("height", 0);
|
svg.setAttribute("height", 0);
|
||||||
svg.style.visibility = "hidden";
|
|
||||||
svg.style.contain = "strict";
|
|
||||||
this.#_defs = this.#document.createElementNS(SVG_NS, "defs");
|
this.#_defs = this.#document.createElementNS(SVG_NS, "defs");
|
||||||
|
div.append(svg);
|
||||||
svg.append(this.#_defs);
|
svg.append(this.#_defs);
|
||||||
this.#document.body.append(svg);
|
this.#document.body.append(div);
|
||||||
}
|
}
|
||||||
return this.#_defs;
|
return this.#_defs;
|
||||||
}
|
}
|
||||||
@ -161,7 +169,7 @@ class FilterFactory {
|
|||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
if (this.#_defs) {
|
if (this.#_defs) {
|
||||||
this.#_defs.parentNode.remove();
|
this.#_defs.parentNode.parentNode.remove();
|
||||||
this.#_defs = null;
|
this.#_defs = null;
|
||||||
}
|
}
|
||||||
if (this.#_cache) {
|
if (this.#_cache) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user