Skip to content

Commit

Permalink
fix(element): fix in Safari < 16.4
Browse files Browse the repository at this point in the history
fixes #6831
  • Loading branch information
nolimits4web committed Jul 8, 2023
1 parent bb5f49c commit e53fc07
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/swiper-element.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { updateSwiper } from './components-shared/update-swiper.mjs';
//SWIPER_STYLES
//SWIPER_SLIDE_STYLES

class DummyHTMLElement { }
class DummyHTMLElement {}

const ClassToExtend =
typeof window === 'undefined' || typeof HTMLElement === 'undefined'
Expand All @@ -24,17 +24,17 @@ const arrowSvg = `<svg width="11" height="20" viewBox="0 0 11 20" fill="none" xm
`;

const addStyle = (shadowRoot, styles) => {
if (typeof CSSStyleSheet !== 'undefined' && !shadowRoot.adoptedStyleSheets) {
if (typeof CSSStyleSheet !== 'undefined' && shadowRoot.adoptedStyleSheets) {
const styleSheet = new CSSStyleSheet();
styleSheet.replaceSync(styles);
shadowRoot.adoptedStyleSheets = [styleSheet];
} else {
const style = document.createElement('style');
style.rel = 'stylesheet';
style.textContent = styles;
shadowRoot.appendChild(style)
shadowRoot.appendChild(style);
}
}
};

class SwiperContainer extends ClassToExtend {
constructor() {
Expand Down Expand Up @@ -176,19 +176,19 @@ class SwiperContainer extends ClassToExtend {
changedParams: [attrToProp(propName)],
...(propName === 'navigation' && passedParams[propName]
? {
prevEl: '.swiper-button-prev',
nextEl: '.swiper-button-next',
}
prevEl: '.swiper-button-prev',
nextEl: '.swiper-button-next',
}
: {}),
...(propName === 'pagination' && passedParams[propName]
? {
paginationEl: '.swiper-pagination',
}
paginationEl: '.swiper-pagination',
}
: {}),
...(propName === 'scrollbar' && passedParams[propName]
? {
scrollbarEl: '.swiper-scrollbar',
}
scrollbarEl: '.swiper-scrollbar',
}
: {}),
});
}
Expand Down

0 comments on commit e53fc07

Please sign in to comment.