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

Remove inline-styles on .destroy() #83

Closed
Dangoo opened this issue Nov 2, 2015 · 3 comments
Closed

Remove inline-styles on .destroy() #83

Dangoo opened this issue Nov 2, 2015 · 3 comments

Comments

@Dangoo
Copy link

Dangoo commented Nov 2, 2015

Problem:
lory.destroy() does (currently broken see #84) unregister the slider but the styles on the js_slide element remain which can cause odd optical behaviour.

Solution:
Maintain added styles as object and on delete match against the current inline styles of the element (to prevent foreign styles to get deleted) and remove the ones added by lory before.

Update:
The items cloned by lory don't get removed on .destroy() too.

@meandmax
Copy link
Collaborator

meandmax commented Nov 6, 2015

@Dangoo,

I removed all eventlisteners, and as far as I can see all listeners are gone. Hope this helped.

thx Max

@meandmax meandmax closed this as completed Nov 6, 2015
@rjoo
Copy link

rjoo commented Nov 3, 2016

Any chance this can be reopened?

Calling destroy on a lory instance doesn't actually remove the inline styles. Unless I'm missing something. Example:

transition-duration: 0ms; transform: translate3d(-435px, 0px, 0px); transition-timing-function: ease;

@rjoo
Copy link

rjoo commented Nov 3, 2016

After actually looking in the source, I confirmed the suspicion that nothing removes the added styles in the destroy method.

Adding a simple method and calling it when destroyed seems to take care of it.

function untranslate () {
    const style = slideContainer && slideContainer.style;

    if (style) {
        style[prefixes.transition + 'TimingFunction'] = null;
        style[prefixes.transition + 'Duration'] = null;
        style[prefixes.transform] = null;
    }
}

// ...

function destroy () {
    dispatchSliderEvent('before', 'destroy');

    untranslate();
    // ...

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

No branches or pull requests

3 participants