.livequery()在仅接收一个参数时如何工作?
问题描述:
我正在访问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(){.......}。谢谢。
答
这对我来说并不重要,因为从现在开始,我将使用.on,因为我升级了jQuery。