JSFiddle - React, Tailwind, and code Playground
by Kaleb Hornsby
JavaScript
!function _init(win, doc, undef) {
var El = function (el, props) {
if (!(this instanceof El)) {
return El.get(el);
};
this.$sel = new El.Selector(el);
this.$el = doc.createElement(this.$sel.element);
this.setProps(this.$sel.properties);
this.valueOf = function(){
return this.$el;
}
}
El.prototype = {
constructor: El,
setProps: function(){}
};
El.fn = El.prototype;
El.get = function () {
return 'getting';
}
El.id = document.getElementById.bind(document);
El.Selector = function(sel) {
this.element = sel;
}
win.El = El;
}(this, document);
console.log(El());
console.log(new El('p'));
console.log(El.id('foo'));