日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

jQuery 1.2 带来的兼容问题及对策

發(fā)布時間:2023/12/1 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 jQuery 1.2 带来的兼容问题及对策 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

jQuery 1.2 中拋棄了不少之前的功能,因此不能向前兼容,而有不少非官方的 jQuery 插件(比如 thickbox),使用的是 jQuery 1.2 之前的語法開發(fā)的,如果這次還未根據(jù)新版本更新的,則可能會出現(xiàn)問題。下面是一些新的寫法,主要是關(guān)于選擇器 (Selector) 的語法方面:

$("div//p") XPath Descendant Selector
Please use the CSS $("div p") selector instead. Or, use the XPath Compatibility Plugin.

$("div/p") XPath Child Selector
Please use the CSS $("div > p") selector instead. Or, use the XPath Compatibility Plugin.

$("p/../div") XPath Parent Selector
Please use the $("p").parent("div") selector instead. Or, use the XPath Compatibility Plugin.

$("div[p]") XPath Contains Predicate Selector
Please use the new $("div:has(p)") selector instead. Or, use the XPath Compatibility Plugin.

$("a[@href]") XPath Attribute Selector
Note: While this selector is deprecated, it has not yet been removed as of this release (jQuery 1.2).
It is now recommended that you use the CSS selector $("a[href]") instead. Or, use the XPath Compatibility Plugin.

另有一個 jquery.xpath.js 的插件做向前兼容,但我測試下來好像不理想,有很多會不生效。
現(xiàn)在比較好的做法是修改老代碼中使用到 XPath Selector 的語法為 CSS Selector.

全部的更改列表需要仔細(xì)閱讀 jQuery 1.2 的發(fā)布說明:
http://docs.jquery.com/Release:jQuery_1.2

這里只是我對比較重要的方面的一個摘錄。

另外不能理解的就是 jQuery 為什么要把 XPath Selector 的功能分離出去。。。

轉(zhuǎn)載于:https://www.cnblogs.com/RChen/archive/2007/09/27/908354.html

總結(jié)

以上是生活随笔為你收集整理的jQuery 1.2 带来的兼容问题及对策的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。