Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating jQuery from 1.4 to 3.0

I saw that jQuery has the jQuery-migrate script to safely upgrade jQuery. They have two jQuery-migrate repos:

  1. https://github.com/jquery/jquery-migrate (for migrating to 3.x)
  2. https://github.com/jquery/jquery-migrate/tree/1.x-stable (for migrating to 1.9)

Is it necessary to first migrate to 1.9 and then 3.x, or can I just include the first script in my website, and migrate to 3.x directly? Does the 3.x migration script not notify when APIs removed in 1.9 are used?

like image 390
Shane Avatar asked Aug 21 '17 04:08

Shane


People also ask

Is it safe to upgrade jQuery?

Updating jQuery may break your site You won't get any compile errors, but have to test the whole site. This means the risk of updating jQuery is pretty big. Even though it may seem like a big undertaking, jQuery Migrate helps you to find any changed interfaces and let your old code work with a newer jQuery version.

Is jQuery 3 backwards compatible?

jQuery seems to be nicely backward compatible. I have been using it for more than a couple of years now through several versions of the core and have not had issues when upgrading except a few minor ones with some plugins.


1 Answers

This is one of the links you provided: https://github.com/jquery/jquery-migrate. You can find this paragraph in the link you provided in your question:

NOTE: To upgrade to jQuery 3.0, you first need version 1.12.x or 2.2.x. If you're using an older version, first upgrade to one of these versions using jQuery Migrate 1.x, to resolve any compatibility issues. For more information about the changes made in jQuery 3.0, see the upgrade guide and blog post.

Since you want to migrate from jQuery 1.4 to 3.0, and based on what the official documentation says, you first need version 1.12.x or 2.2.x if you plan to use jQuery Migrate 1.x for resolving compatibility issues.

like image 108
Jaime Montoya Avatar answered Oct 06 '22 00:10

Jaime Montoya