2017-09-14 58 views
0

我正在訪問https://github.com/brandonaaron/livequery試圖找到.livequery()的語法。從我可以在官方文檔中看到有,.livequery()可以接受兩個或三個參數:.livequery()在僅接收一個參數時如何工作?

// selector: the selector to match against 
// matchedFn: the function to execute when a new element is added to the DOM that matches 
$(...).livequery(selector, matchedFn); 

// selector: the selector to match against 
// matchedFn: the function to execute when a new element is added to the DOM that matches 
// unmatchedFn: the function to execute when a previously matched element is removed from the DOM 
$(...).livequery(selector, matchedFn, unmatchFn); 

然而,在源代碼中,我檢查,我看到.livequery()只接受一個參數。例如:

$('.js-truncate').livequery(function() { 
    .................................. 
}); 

從我的理解,並根據我的官方文檔中看到,.livequery()的第一個參數始終是「選擇」。 .livequery()接收單個參數時是什麼意思,在我的例子中是這個參數?:function(){.......}。謝謝。

回答

0

這對我來說並不重要,因爲從現在開始,我將使用.on,因爲我升級了jQuery。

相關問題