how would you write a independant JS library(no jquery), that u could just use to check if the document is ready
hey guys , i got a bit of a twisted question , i always wonder how exactly does
work similar to
- $(document).ready(function(){
-
- });
i looked at the source and i see the below code ::
- else if (jQuery.isFunction(selector)) {
- return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready(selector) :
- // Execute immediately if ready is not present
- selector(jQuery);
- }
which is somewhat difficult to understand how does
- $(function(){})
work behind the scenes.
if you had to a function that that checks if the document is ready and more importantly can be called using the same syntax as above , how would you code that part ?
can somebody show me a example ? psedo code will do :D
i know its a bit of a stu pid question , but i would appreciate any insight .
Thank you.
Gautam.