JQuery obtains Dom elements and jquerydom elements.
(Function (window ){
Var arr = [];
Var VP = function (selector, context ){
Return new VP. fn. init (selector, context );
}
VP. fn = VP. prototype = {
Constructor: VP,
Init: function (selector, context ){
Var _ document = invalid argument Doc ument, elem, mark = selector. charAt (0 );
If (mark = '#'){
Elem = _ document. getElementById (selector. substring (1 ));
If (elem ){
This [0] = elem;
This. length = 1;
}
}
Return this;
},
Splice: arr. splice,
};
VP. extend = VP. fn. extend = function (){
Var options, name, src, copy, copyIsArray, clone,
Target = arguments [0] | | {},
I = 1,
Length = arguments. length,
Deep = false;
If (typeof target = "boolean "){
Deep = target;
Target = arguments [I] || {};
I ++;
}
If (typeof target! = "Object "&&! VP. isFunction (target )){
Target = {};
}
If (I === length ){
Target = this;
I --;
}
For (; I <length; I ++ ){
If (options = arguments [I])! = Null ){
For (name in options ){
Src = target [name];
Copy = options [name];
If (target = copy ){
Continue;
}
If (deep & copy & (VP. isPlainObject (copy) |
(CopyIsArray = VP. isArray (copy )))){
If (copyIsArray ){
CopyIsArray = false;
Clone = src & VP. isArray (src )? Src: [];
} Else {
Clone = src & VP. isPlainObject (src )? Src :{};
}
Target [name] = VP. extend (deep, clone, copy );
} Else if (copy! = Undefined ){
Target [name] = copy;
}
}
}
}
Return target;
};
VP. fn. extend ({
Get: function (){
Return this [0];
},
});
VP. fn. init. prototype = VP. fn;
Window. VP = VP;
}) (Window );