2014-01-05 98 views
3

我在測試JQuery時看到了Chrome的自動填充建議,並且看到$$$x被定義。他們是什麼,他們來自哪裏?我看到What is the variable $x used for in Chrome?,但$$是什麼?

> $ 
    function (selector, context) { 
     // The jQuery object is actually just the init constructor 'enhanced' 
     return new jQuery.fn.init(selector, context, rootjQuery); 
    } jquery.js?body=1:62 
> $$ 
    function $$() { [Command Line API] } 
> $x 
    function $x() { [Command Line API] } 

這是ogooglebar的東西。

+5

https://developers.google.com/chrome-developer-tools/docs/commandline-api#selector_1 –

+1

對不起,在近距離投票中跳了一下槍,那個只覆蓋'$ x()'。 symbolhound是一個開始尋找像這樣的東西的好地方:http://symbolhound.com/?q=webkit+%24%24 –

回答

2

$$(selector)

返回給定CSS選擇器匹配的元件的陣列。該命令相當於撥打document.querySelectorAll()

0

我有同樣的問題。從鏈接助攻德里克貼,它看起來像默認存在以下對象:

$() is an alias for document.querySelector() 
$$() is an alias for document.querySelectorAll() 

我檢查器和Firefox,並且這似乎是雙方真實。

當您鏈接jQuery時,$()被jQuery對象替換,但$$()仍然以其默認行爲存在。對於那些對所有這些東西都陌生的人來說,相當困惑。

相關問題