Chrome / Firefox中双美元符号选择器查询功能的来源是什么? [英] What is the source of the double-dollar sign selector query function in Chrome/Firefox?
问题描述
查看这个jsfiddle ,并查看控制台。未定义 $$
。现在,打开一个全新的窗口,并在控制台中输入 $$
。它定义了一个函数,用于获取匹配选择器的所有dom元素的(jQuery样)数组:
> $$
bound:function(){
返回document.querySelectorAll.apply(文档,参数)
}
开发工具?它在Firefox中使用Firebug时也存在。它是由工具本身在内部使用吗?
好的, Firebug Lite 将此定义为:
this。$$ = function(selector,doc){if doc ||!FBL.Firebug.chrome){return FBL.Firebug.Selector(selector,doc)
(查看源代码)。
完整版Firebug 将定义为
this。$$ = function(selector)
{
return FBL.getElementsBySelector(baseWindow.document,selector);
};
其实有记录,是的,它也在内部使用。
所以我认为Google Chrome正在做一些事情相似。
Check this jsfiddle, and have a look at the console. $$
is not defined. Now, open a completely new window, and enter $$
into a console. It defines a function for getting a (jquery-like) array of all the dom elements which match the selector:
> $$
bound: function () {
return document.querySelectorAll.apply(document, arguments)
}
Is this being added by Dev tools? It is also present when using Firebug in Firefox. Is it used internally by the tools themselves?
Well, Firebug Lite defines this as:
this.$$=function(selector,doc){if(doc||!FBL.Firebug.chrome){return FBL.Firebug.Selector(selector,doc)
The full version of Firebug defines this as
this.$$ = function(selector)
{
return FBL.getElementsBySelector(baseWindow.document, selector);
};
This is actually documented and yes, it is used internally as well.
So I assume that Google Chrome is doing something similar.
这篇关于Chrome / Firefox中双美元符号选择器查询功能的来源是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!