From be448991cefe00adcd39bdf6e28e2031f79d54fe Mon Sep 17 00:00:00 2001 From: Ana Lameira Date: Tue, 16 Jul 2024 19:24:57 +0100 Subject: [PATCH] Add layer removal to disconnect callback for all layers --- src/l-image-overlay.js | 4 ---- src/l-layer.js | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/l-image-overlay.js b/src/l-image-overlay.js index dbb5e25..1eb7739 100644 --- a/src/l-image-overlay.js +++ b/src/l-image-overlay.js @@ -45,10 +45,6 @@ class LImageOverlay extends LLayer { ); } - disconnectedCallback() { - this.layer?.remove(); - } - attributeChangedCallback(name, _oldValue, newValue) { if (this.layer !== null) { if (name === "url") { diff --git a/src/l-layer.js b/src/l-layer.js index d94d46f..375387c 100644 --- a/src/l-layer.js +++ b/src/l-layer.js @@ -3,6 +3,10 @@ class LLayer extends HTMLElement { super() this.layer = null } + + disconnectedCallback() { + this.layer?.remove(); + } } export default LLayer