Does jQuery do the initial processing?

Simple question. If you enable jQuery in an HTML page, are there any initialization overhead before using any jQuery functions.

+5
source share
3 answers

Due to the simple inclusion of a jQuery script, you really get some overhead. jQuery is created inside the immediately executed function .

In 1.3.2, the biggest things it does to support IE are:

  • creates a temporary element formwith one element inputinside it to check whether the browser returns elements by name when requested getElementById- [ Source ]
  • div comment node , , getElementsByTagName("*") - []
  • , , getAttribute href - []
  • div html :

    '   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>'
    

    . jQuery.support , jQuery.browser - []

, :

  • navigator.userAgent .
  • (+new Date)

, , .

+12

, . , , 4 .

+1

jQuery itself doesn’t say much about load time, but, of course, loading the script, parsing it, and executing inline code to determine all its functions takes a little time. It is unlikely to be very significant on its own in a regular desktop browser.

+1
source

All Articles