From d46fe1c3241c1a8935fbe284444fd1a79af3b9d2 Mon Sep 17 00:00:00 2001 From: Mateusz Krzeszowiak Date: Tue, 20 May 2025 09:25:29 +0200 Subject: [PATCH] fix(element): attach container shadow DOM on init --- src/swiper-element.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/swiper-element.mjs b/src/swiper-element.mjs index 387d03187..a87333e94 100644 --- a/src/swiper-element.mjs +++ b/src/swiper-element.mjs @@ -40,8 +40,6 @@ const addStyle = (shadowRoot, styles) => { class SwiperContainer extends ClassToExtend { constructor() { super(); - - this.attachShadow({ mode: 'open' }); } static get nextButtonSvg() { @@ -149,6 +147,9 @@ class SwiperContainer extends ClassToExtend { initialize() { if (this.swiper && this.swiper.initialized) return; + + this.attachShadow({ mode: 'open' }); + const { params: swiperParams, passedParams } = getParams(this); this.swiperParams = swiperParams; this.passedParams = passedParams;