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

Prevent exception removing class from deleted elements #320

Merged
merged 1 commit into from
Mar 10, 2019

Conversation

ronaldozanoni
Copy link
Contributor

I was having an issue trying to destroy a Glide instance when some elements aren't in the DOM anymore.
I'm using AngularJS and I'm rendering the slides and controls dynamically.
After rendering the slides to update the slider, I'm re-creating the Glide to update the slider with the new items, and it was throwing an exception when trying to render fewer items than before.

For example:

  • I have a Glide with 5 slides.
  • Then, I update my array and changed it to 4 slides.
  • After rendering it, I'm destroying and creating my Glide slide again
  • When destroying, it is failing to try to delete the class for the removed element (the last slide)

I'm using the glideInstance.destroy() method to destroy the Glide component.

See the exception below:
image
image

I hope it can help anyone more.

@jedrzejchalubek jedrzejchalubek merged commit 403ff75 into glidejs:master Mar 10, 2019
@jedrzejchalubek
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants