Skip to content
This repository

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

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

4 participants

HitmanInWis Patrick Filler T.J. Schuck Ken Earley
HitmanInWis

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.

T.J. Schuck
Owner

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!

Patrick Filler
Owner

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

Patrick Filler pfiller closed this December 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.