A key function of jQuery. It is a key function of jQuery.

Source: Internet
Author: User

A key function of jQuery. It is a key function of jQuery.

JQuery. extend = jQuery. fn. extend = function (){
// Copy reference to target object
Var target = arguments [0] | |{}, a = 1, al = arguments. length, deep = false;

// Handle a deep copy situation

// This IF condition is basically always false. It is true only when the target object is of the boolean type, that is, this code does not seem to have any effect.

If (target. constructor = Boolean ){
Deep = target;
Target = arguments [1] || {};
}

// Extend jQuery itself if only one argument is passed
If (al = 1 ){
Target = this;
A = 0;
}

Var prop;

For (; a <al; a ++)
// Only deal with non-null/undefined values
If (prop = arguments [a])! = Null)
// Extend the base object
For (var I in prop ){
// Prevent never-ending loop
This piece of code does not know how to implement it. It is used to block the endless loop, but I don't know how it blocks it. It seems that it has no effect.
If (target = prop [I])
Continue;

// Recurse if we're merging object values
If (deep & typeof prop [I] = 'object' & target [I])
JQuery. extend (target [I], prop [I]);

// Don't bring in undefined values
Else if (prop [I]! = Undefined)
Target [I] = prop [I];
}

// Return the modified object
Return target;
};

 


How does jquery keep a function running?

Jquery is used more. Let's use native js.

Two methods
First
Function allRunFunction (){
//

}
SetInterval (allRunFuntion 1000 );

Second
Function allRunFunction (){
SetTimeout (allrunfunctions, 1000 );

}

Jquery defines a jquery Function

Change the Div ID to Class, use each to locate it, and bind it to Click.
$ (". Id"). each (fuction (){
Var idobj = $ (this );
Idobj. click (function (){
// Write your Click function here
});
});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.