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

Original style values used for restoration onDestroy are overridden onCreate #103

Open
joshua-econify opened this issue Oct 17, 2019 · 0 comments · May be fixed by #104
Open

Original style values used for restoration onDestroy are overridden onCreate #103

joshua-econify opened this issue Oct 17, 2019 · 0 comments · May be fixed by #104

Comments

@joshua-econify
Copy link
Collaborator

Writing some tests to familiarize with ad.js (+ bonus increase coverage) and came across:

    this.originalStyle = container.style;

    container.style.position = 'sticky';
    container.style.top = `${stickyOffset}px`;

https://github.com/Econify/ad.js/blob/master/src/plugins/Sticky.ts#L34

Understanding is original style is a reference to container.style so the next line that sets the value of container.style overwrites the original value to be preserved in this.originalStyle (used for restoration in .onDestroy -> .cleanUp). As is this means position and top if set are never restored to their original values onDestroy -> cleanUp.

Fix and test coverage here: https://github.com/Econify/ad.js/tree/bugfix/restore-original-container-style-on-destroy

@joshua-econify joshua-econify linked a pull request Oct 17, 2019 that will close this issue
8 tasks
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 a pull request may close this issue.

1 participant