我正在访问https://github.com/brandonaaron/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()的第一个参数始终是“selector”。当.livequery()收到一个参数时,这是什么意思,在我的情况下这个参数是?:function(){.......}。谢谢。
答案 0 :(得分:0)
现在对我来说无关紧要,因为从现在起我将使用.on,因为我升级了jQuery。