Skip to content

Instantly share code, notes, and snippets.

@kswlee
Created July 26, 2012 14:24
jQuery init function (partial)
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment