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

Destroy Method should not remove select input listeners... #2461

Closed
kaipiyann opened this issue Oct 15, 2015 · 2 comments
Closed

Destroy Method should not remove select input listeners... #2461

kaipiyann opened this issue Oct 15, 2015 · 2 comments

Comments

@kaipiyann
Copy link

Hi,

I found an issue with the Prototype version of Chosen. When you destroy a chosen instance the destroy method call on Line 711:

this.form_field.stopObserving();

But this method removes all the listener of the form_field...It would be a lot better to just remove the chosen listener like this :

this.form_field.stopObserving("chosen:updated");
this.form_field.stopObserving("chosen:activate");
this.form_field.stopObserving("chosen:open");
this.form_field.stopObserving("chosen:close");

Because in my case I wanted to destroy then rebuild a chosen select because the select was not visible and the chosen one take a 0 width...but when doing so I lost the original listeners of my select field.

Thks

@stof
Copy link
Collaborator

stof commented Dec 2, 2015

this method is meant to remove the listeners registered by chosen, and there are many more than the 4 you list here.

@kaipiyann
Copy link
Author

@stof I don't think there are more observer on the form_field.
But even if I forgot one I think you understand my point : If a listener has been added outside of Chosen I don't think it should be remove by Chosen without notice...

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

No branches or pull requests

3 participants