将jQuery从1.4迁移到3.0 [英] Migrating jQuery from 1.4 to 3.0

查看:279
本文介绍了将jQuery从1.4迁移到3.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到jQuery具有jQuery-migrate脚本来安全地升级jQuery.他们有两个jQuery迁移存储库:

  1. https://github.com/jquery/jquery-migrate (用于迁移到3 .x)
  2. https://github.com/jquery/jquery-migrate/tree/1.x-stable (用于迁移到1.9)

是否有必要先迁移到1.9,然后再迁移到3.x,还是可以仅将第一个脚本包含在我的网站中,然后直接迁移到3.x?当使用1.9中删除的API时,3.x迁移脚本不会通知吗?

解决方案

这是您提供的链接之一: https://github.com/jquery/jquery-migrate .您可以在问题中提供的链接中找到此段:

注意:要升级到jQuery 3.0,首先需要版本1.12.x或2.2.x.如果您使用的是旧版本,请先使用jQuery Migrate 1.x升级到其中一个版本,以解决所有兼容性问题.有关jQuery 3.0中所做更改的更多信息,请参阅升级指南和博客文章.

由于要从jQuery 1.4迁移到3.0,并且要根据官方文档的说明,如果计划使用jQuery Migrate 1.x解决兼容性问题,则首先需要版本1.12.x或2.2.x./p>

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?

解决方案

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.

这篇关于将jQuery从1.4迁移到3.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆