Home > Web Front-end > JS Tutorial > (jQuery, mootools, dojo) Use a programming alias that suits you_jquery

(jQuery, mootools, dojo) Use a programming alias that suits you_jquery

WBOY
Release: 2016-05-16 18:19:42
Original
1312 people have browsed it

For example, you can often see the following code in jQuery

Copy the code The code is as follows:

( function($){
//some code
})(jQuery)

This way you can use $ instead of jQuery;

In mootools you can Written like this, because in mootools $$ represents a set

Copy the code The code is as follows:

(function($){
//do sth.
})(document.id)

In Dojo you can write like this
Copy code The code is as follows:

(function(d,$){
})(dojo,dojo. query)

In this case, you can use $ instead of dojo.query in dojo; to achieve fast conversion from jQuery to dojo;
To imitate mootools, you can write like this
Copy code The code is as follows:

(function(d,$,$$){
/ /do sth;
})(dojo.dojo.ById,dojo.query)

This way you can use $ instead of dojo.ById and $$ instead of dojo.query;
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template