sizcache 和 sizset 在 jQuery 中的作用是什么
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3782709/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What purpose do sizcache and sizset serve in jQuery
提问by jaywon
I am using jQuery, and in inspecting the DOM of my page in IE with the Dev Toolbar I see that many elements have sizset
and sizcache
attributes added to the element. I don't see these in Chrome or Firefox? Also, I see that many elements on the page share the same value for these fields leading me to believe it was a global value, but a few do have different values?
我使用jQuery,并与开发工具栏检查我的页面的DOM在IE中我看到,很多元素都sizset
和sizcache
属性添加到元素。我在 Chrome 或 Firefox 中看不到这些?此外,我看到页面上的许多元素对这些字段共享相同的值,这让我相信这是一个全局值,但有几个元素确实具有不同的值?
<html xmlns="http://www.w3.org/1999/xhtml" sizcache="66" sizset="0">
<head>...</head>
<body sizcache="66" sizset="0">
<div class="ui-datepicker-group ui-datepicker-group-first" sizcache="18" sizset="0">
</body>
</html>
Does anyone know why IE only shows these, and what purpose they serve?
有谁知道为什么 IE 只显示这些,以及它们的用途是什么?
回答by meder omuraliev
it's meant for internal use only. The jQuery core file uses it to
calculate nth-child. Here is the source (with my emphasis):
它仅供内部使用。jQuery 核心文件使用它来
计算 nth-child。这是来源(我的重点):
It looks like nodeIndex
and sizcache
and sizset
are all used internally to calculate the nth-child.
看起来nodeIndex
和sizcache
和sizset
都在内部用于计算第 n 个孩子。