1

How document.ready event is implemented in jQuery. I mean whether they have used defer(which does not work in old browser) option in script tag or they dynamically add script.

2
  • 1
    The ready event is an implementation of the various events that the browsers offer to signal that the DOM (the basic structure of the page, but not yet all images and resources) has been loaded. It works in all browsers that jQuery supports, so there is no need to worry about compatibility. Commented Apr 18, 2011 at 10:32
  • 1
    As for the implementation, see the source (search for "bindReady:"). Commented Apr 18, 2011 at 10:34

1 Answer 1

2

It uses feature detection and it defaults to window.onload if nothing better is supported:

http://jqueryjs.googlecode.com/svn/trunk/jquery/src/event.js

Scroll down to function bindReady() {:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.