Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ambiguous Coffeescript line becomes filthy poopy JavaScript #193

Closed
AndrewRayCode opened this issue Aug 18, 2011 · 2 comments
Closed

Ambiguous Coffeescript line becomes filthy poopy JavaScript #193

AndrewRayCode opened this issue Aug 18, 2011 · 2 comments
Labels

Comments

@AndrewRayCode
Copy link

https://github.com/harvesthq/chosen/blob/master/coffee/chosen.jquery.coffee#L316

if( @active_field and not($(evt.target).hasClass "search-choice" or $(evt.target).parents('.search-choice').first) and not 

https://github.com/harvesthq/chosen/blob/master/chosen/chosen.jquery.js#L381

if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {

Obviously not what you intended. first isn't called as a method, hasClass is checking for more than it should be. It's kind of scary this has been in the chosen source all along, because who knows what kind of behavior this is triggering.

@svieira
Copy link

svieira commented Aug 25, 2011

Since "search-choice" is truthy || $(evt.target).parents('.search-choice').first never gets evaluated, thus avoiding runtime erorrs. However, it's probably not what you wanted to do -- looks like updated .hasClass "search-choice" to .hasClass("search-choice") should fix things.

@kenearley
Copy link

This has been cleaned up in PR #1163 and is merge to master.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants