Skip to content

Commit

Permalink
fix(solid): stop using cloneNode in sliders without loops in SolidJS (#…
Browse files Browse the repository at this point in the history
…5860)

This allows events be assigned to the slides as usually
  • Loading branch information
TiagoCavalcante authored Jul 8, 2022
1 parent 0136bc1 commit d14c432
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 1 addition & 5 deletions src/solid/swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,7 @@ const Swiper = (props) => {
return renderVirtual(swiperRef, slides, virtualData());
}
if (!params().params.loop || (swiperRef && swiperRef.destroyed)) {
return slides.map((child) => {
const node = child.cloneNode(true);
node.swiper = swiperRef;
return node;
});
return slides;
}
return renderLoop(swiperRef, slides, params().params);
}
Expand Down
6 changes: 2 additions & 4 deletions src/solid/virtual.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ function renderVirtual(swiper, slides, virtualData) {
return slides
.filter((child, index) => index >= virtualData.from && index <= virtualData.to)
.map((child) => {
const node = child.cloneNode(true);
node.swiper = swiper;
Object.assign(node.style, style);
return node;
Object.assign(child.style, style);
return child;
});
}

Expand Down

0 comments on commit d14c432

Please sign in to comment.