gpt4 book ai didi

javascript - jQuery/JS 是否返回实际的 DOM 节点,或者只是对它们的引用?

转载 作者:数据小太阳 更新时间:2023-10-29 05:38:16 26 4
gpt4 key购买 nike

我问的原因是因为我正在考虑在我拥有的这个巨大的多维数组中存储一堆 DOM 节点。

成本:占用内存空间。问题是有多少空间,这取决于我获取的是引用还是实际的 DOM 节点。

好处: 1) 它会使我的代码简单很多。 2) 我可以避免遍历,而只是从我的数组中引用 DOM 节点。

想法?

最佳答案

来自 jQuery 网站:

… jQuery() — which can also be written as $() — searches through the DOM for any elements that match the provided selector and creates a new jQuery object that references these elements

jQuery Documentation

关于javascript - jQuery/JS 是否返回实际的 DOM 节点,或者只是对它们的引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31519004/

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