Many mistakes, lots of advice.
Remove the cumbersome code, which is equivalent to a miniature jquery framework.
A JS function, the closure of the input window variable run,
(function(window) {
Defines a jquery assignment to 3 variables, returning an instantiation of an object JQuery.fn.initvarJQuery = Window.jquery = window.$ =function(Selector, context) {return NewJQuery.fn.init (selector, context); };
Defines the Fn,jquery.prototype under JQuery as an object Jquery.fn= Jquery.prototype = {
function named Init, the function is to warn the first parameter selector init:function(Selector, context) {alert ("The currently selected element is:" +selector); },
Add function, warning text, return this, point to, convenient chain call, add:function() {alert ("Execution method: Add ()"); return This; } }
For chained calls, the entire jquery function function is within each init function. JQuery.fn.init.prototype=Jquery.fn;}) (window); $("DD"). Add (). Add (); The element that pops up the current selection is: DD,
——————————————————————
Knowledge Points:
1. Closures
Http://www.cnblogs.com/dewin/archive/2010/06/17/1759477.html
2. function can be called with $
The original code var jQuery = window.$ = Window.jquery;
When you visit outside the closure, such as with JQuery, the window.jquery,$ is actually the same as the global variable. The global member in JS refers to adding properties to the window, and vice versa.
3.
$ ("DD"). Add (). Add ();
In a logical order, $ ("DD") accesses the function and passes the first parameter DD, returning a pending block.
Instantiate, New JQuery.fn.init (), locate the function declaration, jquery.fn the property of the object of the Init function. Pass in the parameter dd, execute function, will pop up the currently selected element is: DD;
$ ("DD"). Add (), pass
()
jQuery2.1.1 Source Code Analysis (i)---mini-jquery framework