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

Use Array.isArray instead of jQuery.isArray #724

Closed
ncardeli opened this issue Apr 15, 2020 · 0 comments · Fixed by #725
Closed

Use Array.isArray instead of jQuery.isArray #724

ncardeli opened this issue Apr 15, 2020 · 0 comments · Fixed by #725

Comments

@ncardeli
Copy link
Contributor

This is an issue I found when migrating a code base from jQuery 1.12 to jQuery 3.5.

Using jQuery-Migrate I'm getting a warning because Bootstrap Switch uses jQuery.isArray, that is deprecated.

From jQuery-Migrate:

Cause: Older versions of JavaScript made it difficult to determine if a particular object was a true Array, so jQuery provided a cross-browser function to do the work. The browsers supported by jQuery 3.0 all provide a standard method for this purpose.

Solution: Replace any calls to jQuery.isArray with Array.isArray.

Instead of using jQuery.isArray, Array.isArray should be used. This shouldn't be a problem as all the browsers supported by Bootstrap Switch implement Array.isArray.

Steps to reproduce:

On a page that uses Bootstrap Switch

  1. Include jQuery 3.5
  2. Include jQuery-Migrate 3.2 for development
  3. The following message should appear in the console when opening the page:
    JQMIGRATE: jQuery.isArray is deprecated; use Array.isArray
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

Successfully merging a pull request may close this issue.

1 participant