使用 jQuery 地址而不使用 jquery-migrate

Using jQuery Address without jquery-migrate

我已将 jQuery 从 1.3.1 升级到 3.2.1。在这个过程中,我使用了jquery-migrate-1.4.1.js。当我删除 jquery-migrate-1.4.1.js 时,页面停止正常工作,直到我也删除 jquery.address-1.5.min.js。我需要 jquery-migrate-1.4.1.js 的唯一原因是因为 jquery.address-1.5.min.js 使用了已弃用的代码。否则,我将能够摆脱 jquery-migrate-1.4.1.js 因为我所有的代码和插件现在都与 jQuery 3.2.1 兼容。我正在阅读 https://github.com/asual/jquery-address/issues/159,报告的问题是 "after upgrading to jQuery 1.9, jQuery Address stops working"。此人报告说使用 jquery-migrate 时一切正常,但有一些警告:

JQMIGRATE: jQuery.browser is deprecated jquery-migrate-1.0.0.js:29
JQMIGRATE: AJAX events should be attached to document: ajaxComplete jquery-migrate-1.0.0.js:29
JQMIGRATE: jQuery.fn.live() is deprecated jquery-migrate-1.0.0.js:29

我正在使用 jquery.address-1.5.min.js,这是 http://www.asual.com/jquery/address/ 上可用的最新版本,它仍然与 jQuery 3.2.1 不兼容.在我的例子中,它需要 jquery-migrate-1.4.1.js,因为 jquery.address-1.5.min.js 包含已弃用的 jQuery 代码。

如何在没有 jquery-migrate 的情况下使用 jQuery 地址?我想我必须修改原始 jquery.address-1.5.min.js 并用现代 jQuery 等价物替换遗留代码。可惜 jquery.address-1.5.min.js 没有提供更新的版本。 jQuery 地址插件 v1.5 来自 2012-08-17 16:32:52 -0700(2012 年 8 月 17 日,星期五)。谢谢。

解决方案来自 t​​rincot 写给问题的评论。我一直认为 jQuery Address 1.5 是可用的最新版本,因为那是他们在 http://www.asual.com/jquery/address/. 1.5 appears as the only version available to download, and I cannot find version 1.6 anywhere. Why do they have version 1.6 only at https://github.com/asual/jquery-address and https://cdnjs.com/libraries/jquery.address, but not in the official page of the plugin at http://www.asual.com/jquery/address/? Or maybe http://www.asual.com/jquery/address/ 上的版本,不是插件的官方页面吗?

我要把这个问题标记为已解决,因为通过使用 jQuery 地址 1.6,我不再需要 jquery-migrate-1.4.1.js,所以问题是已经得到满意的答复。但是,我仍然认为 jQuery 1.6 应该可以从 http://www.asual.com/jquery/address/ to avoid confusion, or remove that link and redirect to the official website of the plugin, in case http://www.asual.com/jquery/address/ 获得,而不是官方网站。

根据 github the latest version is 1.6, which adds "Support for jQuery 1.9". So it should solve the problem you quoted from issue 159 上的项目信息,这与 jQuery 1.9

的兼容性问题特别相关

我看到您也可以从 cdnjs.com.

访问 jQuery 地址版本 1.6