what is difference between
$(function(){ });
and
$(document).ready(function() { });
} else if (jQuery.isFunction(selector)) { return rootjQuery.ready(selector); }
From the source
Calling $(document).ready(selector) saves a few if statements.
$(document).ready(selector)
Although jQuery does cache $(document) internally that might make $(f) faster.
$(document)
$(f)
Benchmarked