Simple question. If you include jQuery in a page of HTML, is there any initialization overhead before one uses any jQuery functions.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
By virtue of simply including the jQuery script, you do indeed get some overhead. jQuery builds itself up inside an immediately executed function.
In 1.3.2 the biggest things it does are for IE support:
formelement with oneinputelement inside it, to check to see if the browser returns elements by name when querying bygetElementById– [Source]divwith a emptycommentnode in it, to check to see if the browser returns only elements when doinggetElementsByTagName("*")– [Source]getAttributereturns normalizedhrefattributes – [Source]creates a temporary
divwith this html in it:and proceeds to read off a bunch of characteristics from that structure. This is to build the
jQuery.supportobject that was created in lieu of deprecatingjQuery.browser– [Source]It also does some smaller things like:
navigator.userAgentfor some deprecated browser sniffing support+new Date)Keep in mind all this barely adds up to any noticeable lag, as others have suggested.