gpt4 book ai didi

javascript - jQuery 当前是否使用 native 查询选择器 API?

转载 作者:行者123 更新时间:2023-11-29 10:43:45 25 4
gpt4 key购买 nike

我在想这个问题,

jQuery 目前使用原生查询选择器 API 吗?

来自这个基准:http://jsperf.com/jquery-vs-document-queryselector

原生 API 的性能比 jQuery 库快得多

jQuery 会使用原生 API 来提高查询性能吗?

最佳答案

如果您查看最新的代码库:

1.11.1 https://github.com/jquery/jquery/blob/1.11.1/dist/jquery.js#L1200

2.1.1 https://github.com/jquery/jquery/blob/2.1.1/dist/jquery.js#L1164

他们都检查对 querySelectorAll 的支持,并将使用它。在存在的情况下,您将获得与使用 jquery 和 querySelectorAll 时相似的速度(由于额外的函数调用,可能存在一些性能差异)。好处是您确定它可以在旧版浏览器中运行。

关于javascript - jQuery 当前是否使用 native 查询选择器 API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23740810/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com