Skip to content

Commit

Permalink
feat(element): add eventsPrefix prop to avoid collision with native…
Browse files Browse the repository at this point in the history
… events

fixes #6450
  • Loading branch information
nolimits4web committed Mar 16, 2023
1 parent d7c0ef7 commit d5df91f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components-shared/params-list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* underscore in name -> watch for changes */
const paramsList = [
'eventsPrefix',
'modules',
'init',
'_direction',
Expand Down
5 changes: 4 additions & 1 deletion src/element/swiper-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ class SwiperContainer extends ClassToExtend {
touchEventsTarget: 'container',
...(swiperParams.virtual ? {} : { observer: true }),
onAny: (name, ...args) => {
const event = new CustomEvent(name.toLowerCase(), {
const eventName = swiperParams.eventsPrefix
? `${swiperParams.eventsPrefix}${name.toLowerCase()}`
: name.toLowerCase();
const event = new CustomEvent(eventName, {
detail: args,
bubbles: true,
cancelable: true,
Expand Down

0 comments on commit d5df91f

Please sign in to comment.