livequery

How does .livequery() work when it only receives one parameter?


I was visiting https://github.com/brandonaaron/livequery trying to find the syntax of .livequery(). From what I can see there in the official documentation, .livequery() can receive two or three parameters:

// 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 );

However, in the source code I am examining, I see .livequery() receiving only one parameter. For example:

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

From what I understand and based on what I see in the official documentation, the first parameter of .livequery() is always "selector". What does it mean when .livequery() receives a single parameter, which is this parameter in my case?: function(){.......}. Thank you.


Solution

  • It is irrelevant for me now because from now on I will use .on, since I upgraded jQuery.