Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught DOMException: Failed to execute 'remove' on 'DOMTokenList' after upgrade #4247

Closed
hirbod opened this issue Feb 17, 2021 · 8 comments

Comments

@hirbod
Copy link

hirbod commented Feb 17, 2021

  • Swiper Version: 6.4.14
  • Platform/Target and Browser Versions macOS, every browser

What You Did

EXPLAIN WHAT YOU DID, PREFERABLY WITH CODE EXAMPLES, HERE.

Upgraded from 6.4.5 to 6.4.14

Expected Behavior

EXPLAIN WHAT IS TO BE EXPECTED, HERE.

Since the update, I get a
Uncaught DOMException: Failed to execute 'remove' on 'DOMTokenList': The token provided must not be empty.

Actual Behavior

Should not throw error

Bildschirmfoto 2021-02-17 um 17 21 13

@nolimits4web
Copy link
Owner

Would be great to see minimal live demo with the issue

@hirbod
Copy link
Author

hirbod commented Feb 17, 2021

My application is HUGE. I just updated from 6.4.5 to 6.4.15 and this issue did appear. I have multiple sliders on my page, I will try to isolate the issue.

@hirbod
Copy link
Author

hirbod commented Feb 17, 2021

@nolimits4web I did a downgrade from 6.4.14 back to 6.4.5 and the issue is gone. Since the error is happening in DOM7, I guess some changes there introduced the regression

@nolimits4web
Copy link
Owner

nolimits4web commented Feb 17, 2021

There were no any changes to Dom7 since then. Still need to see live example (Fiddle/CodeSandbox/...) to see know where it comes from

@hirbod
Copy link
Author

hirbod commented Feb 17, 2021

@nolimits4web the issue is not traceable locally on my development setup but once I deploy in production, it happens. I did few more tests, and even 6.4.12 is working perfectly. The error appears as soon as I upgrade to 6.4.14. It should be easy to trace the differences between the releases to get a clue what has been changed

@hirbod
Copy link
Author

hirbod commented Feb 17, 2021

@nolimits4web I got the reason now:

I have a ResizeObserver which destroys the swiper if a resize on the container is detected and reinitialize it. And this is breaking since 6.4.14.

  _registerObserver() {
    const ro = new ResizeObserver(() => {
      // this operation is pretty heavy but
      // the recalculation is heavy so we need to reinit
      this.swiper.destroy()
      this._initCarousel()
    })
    ro.observe(this._element.querySelector('.swiper-container'))
  }

@hirbod
Copy link
Author

hirbod commented Feb 17, 2021

Looks like you were faster than me :D

@chabb
Copy link

chabb commented Feb 18, 2021

Thanks, just got the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants