This article will introduce the source code analysis of extend and $. extend in jquery, and hope to help you.
I haven't written jquery source code for a long time ..There is a major factor in jquery's development because it is very easy to expand,
Differences between jquery. fn. extend and jquery. extend, jquery. fn. extend
1. jquery. extend (object); add a new method for the class to extend the jQuery class itself.Jquery. fn. extend (object); add a method to the jQuery object.
$. Extend
Since it is a class, there is an abstract class, a specific class, and class inheritance. At the same time, the class members can have instance members and static members. Let's take a look at how prototype achieves this.First look at the following
Extend functions in jQuery
In the jQuery API manual, we can see that extend is actually mounted to jQuery and jQuery. two different methods on fn, although jQuery. extend () and jQuery. fn. extend () is implemented using the same code, but their
Extend functions in jQuery
In the jQuery API manual, we can see that extend is actually mounted to jQuery and jQuery. two different methods on fn, although jQuery. extend () and jQuery. fn. extend () is implemented using the same code, but their
The source code is as follows:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->VaR abstract = new object ();
Object. Extend = function (destination, source ){
For (property in source ){
Destination
This article mainly introduces the use of extend in JQuery. The example analyzes extend functions, definitions, and related usage skills. if you need it, you can refer to the example in this article to describe how to use extend in JQuery. Share it
This article mainly introduces the use of extend in JQuery. The example analyzes extend functions, definitions, and related usage skills. If you need it, you can refer to the example in this article to describe how to use extend in JQuery. Share it
(This article reproduced: http://www.cnblogs.com/wyjgreat/archive/2011/07/19/2110754.html)
Jquery provides two methods for development plug-ins:
JavaScript code
jQuery.fn.extend(object); jQuery.extend(object);
Jquery. Extend (object); adds a
Prototype (III): object. Extend
The class definition is mentioned above. Prototype distinguishes functions from classes by using a global object class. Since it is a class, there is an abstract class, a specific class, and class
Example Analysis of extend usage in JQuery, jqueryextend
The example in this article describes how to use extend in JQuery. Share it with you for your reference. The specific analysis is as follows:
Extend () is one of the basic functions of jQuery.
Anyone who knows about extension of jQuery objects who has written jquery plug-ins knows that extends provided by jquery can be used to expand jquery objects. In addition, this method can not only expand jquery objects, you can also add new
$. Extend () and $. fn. extend () Functions
$. Extend () and $. fn. extend () functions:The two methods in the title are very important in jQuery plug-in development. The following describes their usage through simple code examples.This topic does
Extend Extension Method of JQuery: The Extension Method of Jquery extend is a commonly used method in the process of writing plug-ins. This method has some heavy-load prototypes. Here, let's get to know about it. 1. The extension method prototype of
This example describes the use of extend in jquery. Share to everyone for your reference. The specific analysis is as follows:
The Extend () function is one of the fundamental functions of jquery, which is to extend an existing object. Extend is a
The Extension Method extend of Jquery is a common method in the process of writing plug-ins. This method has some heavy-load prototypes,Dest is the space to be integrated so that {} or not to write
Src is a javascript Object represented by a JSON
Extend () in jQuery ()
Extend () is one of the basic functions of jQuery. It is used to expand existing objects. For example, the following code:Html code• •
$. Extend (true, obj1, obj2) indicates the extended object obj1 in obj2. The first
The Extension Method extend of Jquery is a common method in the process of writing plug-ins. This method has some heavy-load prototypes,Dest is the space to be integrated so that {} or not to write
Src is a javascript Object represented by a JSON
Jquery $. FN $. FX
$. FN refers to the namespace of jquery. Adding Methods and attributes on FN will be effective for each jquery instance.For example, extend $. FN. ABC (), that is, $. FN. ABC () is an extension of the ABC method for jquery, so
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.