I understand that you are calling a method like this when you expand $.fn.
( $ == jQuery)
$.fn.extend({
myMethod: function(){...}
});
And how is it when you extend the jQuery object:
$.extend({
myMethod2: function(){...}
});
But I do not quite understand what makes $():
// Several methods are called here. Some with the same method name (initiate), which is bad.
// But perhaps that’s why you need an empty jQuery object, so method names don’t collide
$(function() {
$().functionName({
something: 'something'
}).myMethod();
$().func1({
x: 1
}).initiate();
$().func2({
y: 2
}).initiate();
});
Is this because the method is being called, including the name of the function?
Thanks in advance and hope this makes sense.
source
share