Pouring over the release notes regarding jQuery 1.4, I came acrosss $.noop() which is:
Description: An empty function. (added in 1.4)
If you have a function that accepts a function as a parameter, and you don't have any code to give it, you can pass $.noop
.
I can't think of any such cases in jQuery where the parameter isn't optional in the first place, though.
Unlike writing function(){}
, passing $.noop
will not create a new function instance, saving a bit of memory. However, if whatever you're passing it to modifies the function object (eg, funcParam.id = 2
), passing $.noop
will mess things up.