function Facade(){
}
Facade.prototype.Select = function(s){
if(s === undefined){return;}
this.selector = s.trim();
this.elem = document.getElementById(this.selector)
console.log(this)
return this;
}
Facade.prototype.removeClass = function(cls){
var elem = this.elem;
var RTN = " " + elem.getAttribute("class") + " ";
if(elem.getAttribute("class") != "" && elem.getAttribute("class") !== null && elem.getAttribute("class") !== undefined){
RTN = RTN.replace(new RegExp(" " + cls + " ", "g"),"");
RTN = RTN.replace(/ /g, " ");
this.elem.setAttribute("class", RTN.trim());
}
return elem.getAttribute("class");
}
Facade.prototype.addClass = function(cls){
var elem = this.elem;
var clss = "";
if(elem.getAttribute("class") === null){
clss = cls;
}else{
clss = elem.getAttribute("class").trim() + " " + cls;
}
elem.setAttribute("class", clss);
return clss;
}
var facade = new Facade();
var $ = facade.Select.bind(facade);
$("test").addClass("test");