Skip to content

Instantly share code, notes, and snippets.

@SlexAxton
Created December 22, 2011 20:20
Show Gist options
  • Save SlexAxton/1511705 to your computer and use it in GitHub Desktop.
Save SlexAxton/1511705 to your computer and use it in GitHub Desktop.
jQuery constructor recreation attempt
(function (window, undefined) {
var MRTN = (function() {
// The main FeedTheWebDev function
var MRTN = function(element) {
return new MRTN.fn.init(element, rootDoc);
},
// Ref to root document
rootDoc;
MRTN.fn = MRTN.prototype = {
constructor: MRTN,
init: function(element, rootDoc) {
// Handle empty 'constructor'
if (!element) {
return this;
}
// It's a single element
if (element.nodeType) {
this.element = this[0] = element;
this.length = 1;
return this;
}
},
splice : function () {},
length: 0
};
MRTN.fn.init.prototype = MRTN.prototype;
rootDoc = MRTN(document);
return MRTN;
})();
window.MRTN = MRTN;
}(window));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment