(function(window){
var com = function(box){
this.box = document.querySelector(box);
}
window.zhanglei = function(box){
return new com(box);
}
com.prototype ={
addClass:function(cls){
if('classList' in this.box){
this.box.classList.add(cls);
}else{
var preCls = this.box.className;
var newCls = preCls +' '+ cls;
this.box.className = newCls;
}
return this.box;
}
}
})(window)
zhanglei('.box').addClass('zhang');