-
Notifications
You must be signed in to change notification settings - Fork 6
/
css.min.js
1 lines (1 loc) · 1.49 KB
/
css.min.js
1
(function(){var e,t,n,r,i={}.hasOwnProperty;n=function(e,t){var n,r;for(n in t){if(!i.call(t,n))continue;r=t[n],e[n]=r}},r=function(e){return"[object Object]"===Object.prototype.toString.call(e)},e=function(){function e(e,t){this.name=e,this.sheet=t,this.props={},this.node=document.createTextNode("")}return e.prototype.getName=function(){return this.name},e.prototype.properties=function(e){return n(this.props,e),this.refresh(),this},e.prototype.refresh=function(){var e,t,n,r;t=[],r=this.props;for(e in r){if(!i.call(r,e))continue;n=r[e],t.push(""+e+":"+n)}this.node.nodeValue=""+this.name+" { "+t.join(";")+"; }"},e.prototype.getNode=function(){return this.node},e.prototype.selector=function(e,t){return this.sheet.selector(e,t)},e.prototype.remove=function(){return this.sheet.remove(this)},e}(),t=function(){function t(){this.node=document.createElement("style"),this.node.type="text/css",this.selectors={},document.head.appendChild(this.node)}return t.prototype.selector=function(t,n){var r;return this.selectors[t]?r=this.selectors[t]:(r=this.selectors[t]=new e(t,this),this.node.appendChild(r.getNode())),n?(r.properties(n),this):r},t.prototype.remove=function(e){return e?(typeof e=="string"&&this.selectors[e]&&(this.node.removeChild(this.selectors[e].getNode()),delete this.selectors[e]),r(e)&&(this.node.removeChild(e.getNode()),delete this.selectors[e.getName()]),this):(this.node.parentNode.removeChild(this.node),delete this.properties,null)},t}(),this.cssjs={newSheet:function(){return new t}}}).call(this);