Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

Not remove Wrap (span) after after destroy() #66

Open
KaloyanMarinov opened this issue Jan 21, 2020 · 1 comment
Open

Not remove Wrap (span) after after destroy() #66

KaloyanMarinov opened this issue Jan 21, 2020 · 1 comment

Comments

@KaloyanMarinov
Copy link

When we use the function Destroy() the wrap (span) is not removed and another wrap (span) is added when I call it

@St-Permiakov
Copy link

I bumped into same problem and eventually came up with this decision:

this.sticky.destroy();
// delete span wrapper
const wrapper = %sticky_HTMLElement%.parentNode;
const fragment = document.createDocumentFragment();
frag.appendChild(%sticky_HTMLElement%);
wrapper.parentNode.replaceChild(frag, wrapper);

And watch out for deleting wrong wrappers, especially on page loading! That thing turned out to have interval in it, waiting for "full page loading".

Yeah, it looks kinda crappy but it's the best I could work out.
If anyone has a better one, you're most welcome!

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

No branches or pull requests

2 participants