Why is JQuery faster than Javascript at execution time?

 Posted by Niladri.Biswas on 7/19/2012 | Category: jQuery Interview questions | Views: 3801 | Points: 40

The onLoad function for the window object executes after the entire page is fully loaded.Untill DOM tree is completely created and all images/other associated resources (like audio files,video files etc) are fully loaded,this onLoad function is never executed and hence the script execution needs to wait till the page is loaded.

But the document.ready() method of JQuery indicates that the DOM of the page is ready and we can start manipulating the DOM elements even though other parts of the page content(e.g. images/other external resources) are not fully loaded.As soon as the DOM is loaded, everything inside the (document).ready() should be load even before the page contents are loaded.

It is because of this reason that JQuery code runs faster

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response