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

onChange events are shared between instance of selectOrDie #17

Closed
phbou72 opened this issue Sep 23, 2014 · 7 comments
Closed

onChange events are shared between instance of selectOrDie #17

phbou72 opened this issue Sep 23, 2014 · 7 comments

Comments

@phbou72
Copy link

phbou72 commented Sep 23, 2014

I made a little jsFiddle to explain the bug : http://jsfiddle.net/Ls3mcvLu/6/

Select something on the first select. The onChange event is triggered as expected.

Then, select something on the second dropdown. The second dropdown trigger the onChange event and show the value selected on the first select? Notice there is no listener for the event on the second dropdown?

@vestman
Copy link
Owner

vestman commented Sep 24, 2014

I'm on it!

@swapnilmishra
Copy link

@phbou72 @vestman This is not because of selection from second dropdown. Just click anywhere else and the event will be triggered. A possible hack/workaround I am using is this : http://jsfiddle.net/oktg53kv/

@phbou72
Copy link
Author

phbou72 commented Sep 24, 2014

Ok. Clicking elsewhere does trigger the event. But, that still point out a bug in my opinion. Why is the onChange event triggered multiple type? Why not only when we select a new option?

I should not need to use a closure to check if a new option has been selected.

@gerbenvandijk
Copy link

I've fixed this issue guys:

Add this after line 384:

_private.blurSod($sod);

@phbou72 @vestman @swapnilmishra

// all : please ignore the above fix. It does fix the described behaviour, however it peaks my CPU usage completely and results in a hanging browser. Would you check this out @vestman ? Thanks 👍

As far as I can see, the element should be unfocussed after selecting a new one. At the moment, this doesn't happen and when you click outside of the dropdown the event gets fired again. Adding the line above fixed it - but results in a conflict with the rest of the plugin (seems to be some kind of endless loop).

Hope it helps, would be great to get it fixed 👍

vestman pushed a commit that referenced this issue Oct 8, 2014
The major fix was for issue #17. Issues #17 and #19 just tagged along
like the entourage they were…
@vestman
Copy link
Owner

vestman commented Oct 8, 2014

Fixed, thanks for pointing this out, @phbou72! Since you're using the selectordie.min.js from vst.mn as an external resource you can check your original fiddle - http://jsfiddle.net/Ls3mcvLu/6/ - to check that it's working.

@vestman vestman closed this as completed Oct 8, 2014
@gerbenvandijk
Copy link

👍 thanks @vestman

@phbou72
Copy link
Author

phbou72 commented Oct 9, 2014

Thanks a lot @vestman! It work perfectly!

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

4 participants