noeldelgado / gemini-scrollbar

:first_quarter_moon: Custom overlay-scrollbars with native scrolling mechanism for web applications
https://noeldelgado.github.io/gemini-scrollbar/
MIT License
428 stars 63 forks source link

scrollbar elements always removed on destroy() no matter what createElements option is #7

Closed flexphperia closed 9 years ago

flexphperia commented 9 years ago

When createElements option is set to false plugin should not destroy scrollbar and view div's when called destroy() method.

noeldelgado commented 9 years ago

Thanks for the report, I also added a new example to test this issue, you can find it on the examples folder, file 05-destroy.html.

flexphperia commented 9 years ago

Now it looks good but, now when calling destroy when createElements = false references to document and window are not cleaned. I'm not sure that I want gm-prevented added to my container after destroy. Maybe destroy method should get one parameter to remove everything or not?

Another problem is that when when createElements = false in create method plugin re aranges my scrollbar and view divs because it still calls:

this.element.appendChild(this._scrollbarVerticalElement);
this.element.appendChild(this._scrollbarHorizontalElement);
this.element.appendChild(this._viewElement);
noeldelgado commented 9 years ago

Hey @flexphperia, just fixed those issues on this commit fdd8b4c.

No more gm-prevented added after calling destroy, no more elements appended on the create method if createElements option is false and document and window references are now cleaned on destroy.

Thanks!

flexphperia commented 9 years ago

@noeldelgado references still not cleared when SCROLLBAR_WIDTH === 0 Also there should be: this._viewElement = this.element = null;