Jquery entry function test

 

/ * Write a custom jquery frame * / 

(function (window, undefined) {
var njquery = function (Selector,) {
return new new jquery .prototype.init (); / * * the prototype == Fn /
};
jquery. = {the prototype
constructor: njQuery
};

njquery.prototype.init.prototype = njquery.prototype;
window.njquery the window = = $ njquery;.
}) (window);

<! DOCTYPE HTML> 
<HTML lang = "EN">
<head>
<Meta charset = "UTF-. 8">
<title> 02-jQuery entry function example of a test </ title>
</ head>
<body>


<Script the src = "jquery-1.12.4.js"> </ Script>
<Script>
// pass. 1 '' null undefined NaN3 0 to false
// returns an empty jquery object to us;
// the console.log ($ ( ))
// console.log ($ (null))
// console.log ($ (undefined))
// console.log ($ (NaN))
// console.log ($ (0))
// Console. log ($ (to false))


// 2 incoming snippet
// will be stored in the created DOM elements jquery object returned
console.log ($ ( "<p> hihihihihi </ p>"))
// 3 incoming selector
// will find all the elements stored in the jquery object returns
console.log ($ ( "li"))
// passing an array of 4
// will be sequentially stored in the array element stored in the jquery object returns
the console.log ($ ([1,2,3,4,5]))
// incoming dummy array. 5
// will be stored in the array element sequentially stored in the object returned jquery
var likeArr = {0: "LNJ",. 1: "SDA", 2: 'ASD'}
the console.log ($ (likeArr));
// the value of the incoming object. 6
// will incoming objects stored in the object returned jquery
function the Person () {}
the console.log ($ (new new the Person ()));

// incoming DOM elements. 7
// will be passed to the DOM element storage jquery object in return,
the console.log ($ (document.createElement ( 'div')));
// incoming basic data types. 8
// passed will return to the basic data types stored jquery object,
the console.log ( $ (123));
the console.log ($ (to true));

/ *
*
* Conclusion: @ 1 incoming '' null undefined NaN 0 false returns an empty jquery object
* string 2
* 3 array
* In addition to the above type 4
* * /
</ Script>
</ body>
</ HTML>

Guess you like

Origin www.cnblogs.com/Damocless/p/11917039.html