Not updated for a while, today summarize some of jquery's methods and properties one, JQ methods and properties of the overall structure (91 lines--281 line)
Jquery.fn = Jquery.prototype = {
jQuery: Version
constructor: fix points to problem
init (): Initialization and parameter Management
selector: Storing selection strings
Length:this object's length
ToArray (): To the array get (): to
the native collection
pushstack (): JQ object's Stack each
(): Traverse collection
Ready (): Dom Loaded Interface
slice (): Intercept of the collection first (): The Last () of the collection (): The final eq () of the collection ():
The specified map () of the collection:
returns the new collection End
( ): Returns the previous state
push (): (used)
sort (): (internal use)
splice (): (internal use)
}
Second, JQ methods and attributes of the detailed
1. Properties:
Jquery:core_version,//Storage JQ version
constructor:jquery, ///point constructor to JQuery
2. Init method
Initial or JQ, matching JQ selector
Init:function (selector, context, rootjquery) {
//Process Code
}
The JQ selector is written in a few ways:
Tag Class name selection: $ ("#div") $ (". Div") $ ("div") $ (". Div #p")
Create element: $ ("<li>") $ ("<li>111</li>")
object This, Doc Select: $ (this) $ (document)
function: $ (function () {})
type selection: $ ([]) $ ({})
(1) $ (""), $ (null), $ (undefined), $ (false) condition
When we look at the JQ source, we first see two declared variables in the Init method, and second we see the following code in lines 106 to 108:
if (!selector) {return this
;
}
This is mainly selected as $ (""), $ (null), $ (undefined), $ (false)
These kinds of.
The key content here is the THIS,JQ which has been dealt with in this process, what kind of processing, such processing:
$ ("div") as this
= {
0: ' div ',
length:1, context
: //Optional
}
How to do it, we have mentioned earlier: it is the following code implementation
JQuery = function (selector, context) {return to
new JQuery.fn.init (selector, context, rootjquery);
(2) $ ("<div>") $ ("<div></div>") $ ("#div")
Next we can see a second Judge 111--176 line
if (typeof selector = = "string") {}