Dependency on jQuery >= v1.6 .is() function #1471

Closed
HitmanInWis opened this Issue Aug 12, 2013 · 3 comments

Comments

Projects
None yet
4 participants

The Chosen.prototype.test_active_click function has a dependency on jQuery 1.6's version of the .is() function. Prior to 1.6, jQuery's .is() function works with string selectors, but it does not work with DOM or jQuery objects passed as the parameter (see http://api.jquery.com/is/).

The offending code is this:

if (this.container.is($(evt.target).closest('.chosen-container'))) {

The jQuery error I get in firebug using jQuery 1.5.2 is this:

TypeError: expr.replace is not a function

I fixed locally by replacing the offending line of code with:

var chosenContainer = $(evt.target).closest('.chosen-container');
if (chosenContainer.size() > 0 && this.container[0] === chosenContainer[0]) {

Another option would be to change the documentation of the plugin to support jQuery >= v1.6, but if everything else still works w/jQuery 1.4 then it would be great if this bug could be fixed.

Owner

tjschuck commented Aug 12, 2013

Pinging @pfiller about whether the fix is fixing the code or bumping the jQuery version requirement, but I bet he'll prefer the former.

@HitmanInWis Feel free to submit a pull request if you have the time! Thanks!

Contributor

kenearley commented Aug 22, 2013

Contributor

pfiller commented Dec 28, 2013

Closing as #1702 fixes this and was just merged to master.

@pfiller pfiller closed this Dec 28, 2013

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