从jQuery 1.x升级到jQuery 2.x [英] Upgrade from jQuery 1.x to jQuery 2.x

查看:323
本文介绍了从jQuery 1.x升级到jQuery 2.x的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从jQuery 1.x升级到jQuery2.x.

I am trying to upgrade from jQuery 1.x to jQuery 2.x.

我有jQuery 1.8和jQueryUI 1.8,现在我想升级到jQuery 2.x并增强我的Web应用程序.

I have jQuery 1.8 and jQueryUI 1.8, and now I want to upgrade to jQuery 2.x and enhance my web app.

所以我的问题是要更改和删除的内容,例如 Ajax 事件.

So my question is what to change and remove, like for Ajax and events.

就像我正在谈论的这些错误

Like these errors I am talking about

Uncaught TypeError: Object [object Object] has no method 'live'

.on()和.ajax()之类的函数是否有变化? (我知道.live已弃用.)

Did functions like .on() and .ajax() change any? (I know .live was deprecated).

P.S.我必须添加使用jQuery 2的Zurb Foundation 5.

P.S. I have to add Zurb Foundation 5 which uses jQuery 2.

推荐答案

如果您正在考虑将jQuery 1.x升级到jQuery 2.x,则应考虑并采取以下步骤:):

If you are thinking of upgrading to jQuery 1.x to jQuery 2.x should consider this and take these steps :) :

1. 不再支持IE6/7/8

我仍然认为放弃IE8还为时过早,但是团队 等不及了. jQuery 2.0删除了所有旧版IE代码 用于节点选择,DOM操作,事件处理和Ajax.

I still think it’s a little premature to abandon IE8 but the team couldn’t wait any longer. jQuery 2.0 removes all the legacy IE code for node selection, DOM manipulation, event handling and Ajax.

2. 自定义版本功能已在2.0版中进行了改进

因此您可以排除12个未使用的模块中的任何一个,并将jQuery缩小到10Kb以下.可以省略的模块为:功能列表

so you can exclude any of 12 unused modules and shrink jQuery below 10Kb. The modules which can be omitted are: List of Functions

我应该升级吗?

重要的是要了解jQuery 2.0与jQuery 1.9具有API奇偶校验.修复了一些错误,但没有新功能.

It’s important to understand that jQuery 2.0 has API parity with jQuery 1.9. There are a small number of bug fixes but no new features.

但是,如果您是那些放弃了对IE6/7/8的支持的幸运开发人员之一,请使用jQuery 2.0并不要回头.

However, if you’re one of those lucky developers who has dropped support for IE6/7/8, grab jQuery 2.0 and don’t look back.

这篇关于从jQuery 1.x升级到jQuery 2.x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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