Chosen: jQuery.fn.bind is deprecated

Created on 17 Oct 2016  路  13Comments  路  Source: harvesthq/chosen

While moving a codebase from an old jQuery 1.x installation to the latest and greatest (3.1.1), I enabled the jQuery Migration plugin and upgraded Chosen to version 1.6.2. From the console I could see deprecation warnings (see screenshot). I can confirm that the issue is still present on the master branch as of commit dacfa2002e65136b04612fc73e5659de4ef01c69.

image

Steps to reproduce

See this example or just any plain example with jQuery 3.1.1 and jQuery migration plugin 3.0.0.

Expected behavior

I expect no deprecation warnings when I run the migration tool.

Actual behavior

A deprecation warning appears in the browser console log.

Environment

  • Chosen Version: 1.6.2 and master (dacfa2002e65136b04612fc73e5659de4ef01c69)
  • jQuery or Prototype Version: jQuery
  • Browser and Version: Chrome 53.0.2785.143 m
  • OS and Version: Windows 7 Enterprise

Most helpful comment

@koenpunt this is a question between dropping support for a version of jquery released in 2011 or between dropping support for the current jQuery versions. I vote for dropping support of old versions.

All 13 comments

We do not officially supporting jQuery 3 yet. And we do support older jQuery versions (1.4...1.7) that do not have the jQuery.fn.on method. If you have any suggestions on how to make this work for all versions, please let us know 馃槂

@koenpunt I suggets bumping the min requirement to jQuery 1.7 to be able to use .on(). People updating to new versions of Chosen will hopefully be able to update jQuery to a version newer than 4 years.

@stof I don't think that @pfiller will agree on dropping support for older versions of jQuery, if the jQuery.fn.bind function being deprecated is the only issue.

Also, a deprecation doesn't break anything yet, so bind probably will be around until the next major version change.

@koenpunt Unfortunately that means that those who have a dependency on Jquery 3.x, and wish to use slim, cannot, since it strips out all deprecated functions. This is the case for Angular 1.6+.

@koenpunt this is a question between dropping support for a version of jquery released in 2011 or between dropping support for the current jQuery versions. I vote for dropping support of old versions.

Since there is already a chosen.jquery and chosen.proto, why not make a chosen.jquery3 file ?

It's still not me to decide, so please @pfiller can you weigh in on this discussion?

Nb. I dislike the idea of chosen.jquery3

there is no need for a jQuery 3 build IMO. We can support jquery 1.7 and 3.x with the same binding code.
And people who are using a jquery version from 2011 are unlikely to use an uptodate version of chosen anyway (and they should really upgrade jQuery)

I ran into this issue moving my app to jquery 3. Chosen was the only plugin whose latest version still had migration warnings. I vote for fixing this issue.

@pfiller Would you accept dropping support for the jQuery 1.6 version (released in 2011) in favor of supporting jQuery 3 (which is the current stable jQuery version since 1 year now) ?

If no, it may be possible to support both the new and old API in the codebase, but this would increase maintenance.
And as said before, I doubt that people using the latest version will use such an old jQuery version (and then, we can tell them to use an old version of Chosen too if they insist on using outdated jQuery, and forbid them to complain about bugs as they are missing 6 years of jQuery bug fixes anyway)

馃憤 on bumping support to jQuery 1.7+ if that will also include 3 support.

I support adding support for jQuery 3, especially since that is the only version of jQuery without known vulnerabilities. See http://research.insecurelabs.org/jquery/test/ and hit "Run"

@JeffSchwandt jQuery 3 is supported since the 1.8.0 version of Chosen released in august 2017 (which is why this issue was closed in August 2017 too)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vpode picture vpode  路  5Comments

alexfrancavilla picture alexfrancavilla  路  9Comments

engintekin picture engintekin  路  8Comments

raggzy picture raggzy  路  5Comments

blankhang picture blankhang  路  7Comments