1(function(window, undefined) {2 //constructing a jquery object3 varJQuery = (function() {4 varJQuery =function(Selector, context) {5 return NewJQuery.fn.init (selector, context, RO otjquery);6 }7 returnJQuery;8 })();9 //Tool Method UtilitiesTen //callback Function list callbacks Object One //Asynchronous Queue Deferred Object A //Browser function test support - //Data Cache - //Queues Queue the //Property Manipulation Attributes - //Event System Events - //selector Sizzle - //DOM traversal traversing + //DOM Operation Manipulation - //style manipulation CSS (calculated style, inline style) + //Asynchronous Request Ajax A //animated Effects at //coordinate Offset, size Dimensions -Window.jquery = window.$ =JQuery; -}) (window);
1. Anonymous functions are used to prevent variable contamination.
2. Pass the parameter into the window undefined, on the one hand, after the code compression in the Anonymous function window and undefined can be compressed as parameters, can reduce the amount of code, more importantly, window and undefined as a local variable passed in, You can reduce the access distance of the chain, which means that you can get the window object without having to access the window layer. Undefined parameter passed in is to ensure that the value of undefined is really "undefined", because in some browsers, you can modify the value of undefined, such as undefined = ' test ', window.undefined input is test.
Other:
The article is <jquery Technical Insider > Reading notes, http://book.douban.com/subject/25823709/