stylesheet-min.js revision 9706f76f9e56f413801eb2ff719cfbb6bdd3e841
YUI.add("stylesheet",function(C){var J=document,D=J.createElement("p"),B=D.style,G={},E=0,K=("cssFloat" in B)?"cssFloat":"styleFloat",F,A,L,I,H;A=("opacity" in B)?function(M){M.opacity="";}:function(M){M.filter="";};B.border="1px solid red";B.border="";L=B.borderLeft?function(M,O){var N;if(O!==K&&O.toLowerCase().indexOf("float")!=-1){O=K;}if(typeof M[O]==="string"){switch(O){case"opacity":case"filter":A(M);break;case"font":M.font=M.fontStyle=M.fontVariant=M.fontWeight=M.fontSize=M.lineHeight=M.fontFamily="";break;default:for(N in M){if(N.indexOf(O)===0){M[N]="";}}}}}:function(M,N){if(N!==K&&N.toLowerCase().indexOf("float")!=-1){N=K;}if(typeof M[N]==="string"){if(N==="opacity"){A(M);}else{M[N]="";}}};H=J.createElement("p");H.innerHTML="<style></style>";I=H.firstChild?function(M){H=J.createElement("p");H.innerHTML='<style type="text/css">'+M+"</style>";return H.firstChild;}:function(M){H=J.createElement("style");H.type="text/css";if(H.styleSheet){H.styleSheet.cssText=M;}return H;};C.StyleSheet=function(T,O){var W,R,V,U={},N,X,Q;if(!(this instanceof C.StyleSheet)){return new C.StyleSheet(T,O);}W=J.getElementsByTagName("head")[0];if(!W){throw new Error("HEAD element not found to append STYLE node");}R=T&&(T.nodeName?T:J.getElementById(T.replace(/^#/,"")));if(T&&G[T]){return G[T];}else{if(R&&R.yuiSSID&&G[R.yuiSSID]){return G[R.yuiSSID];}}if(typeof T==="string"){if(T.indexOf("{")!=-1){R=I(T);}else{if(!O){O=T;}}}if(!R||!/^(?:style|link)$/i.test(R.nodeName)){R=J.createElement("style");R.type="text/css";}if(R.parentNode!==W){W.appendChild(R);}V=R.sheet||R.styleSheet;N=("cssRules" in V)?"cssRules":"rules";Q=("deleteRule" in V)?function(Y){V.deleteRule(Y);}:function(Y){V.removeRule(Y);};X=("insertRule" in V)?function(a,Z,Y){V.insertRule(a+" "+Z,Y);}:function(a,Z,Y){V.addRule(a,Z,Y);};var S,M,P;for(S=V[N].length-1;S>=0;--S){M=V[N][S];P=M.selectorText;if(U[P]){U[P].style.cssText+=";"+M.style.cssText;Q(S);}else{U[P]=M;}}R.yuiSSID="yui-stylesheet-"+(E++);C.StyleSheet.register(R.yuiSSID,this);if(O){C.StyleSheet.register(O,this);}C.mix(this,{getId:function(){return R.yuiSSID;},enable:function(){V.disabled=false;return this;},disable:function(){V.disabled=true;return this;},isEnabled:function(){return !V.disabled;},setCSS:function(a,Z){var b=U[a],Y;if(b){b.style.cssText=C.StyleSheet.toCssText(Z,b.style.cssText);}else{Y=V[N].length;X(a,"{"+C.StyleSheet.toCssText(Z)+"}",Y);U[a]=V[N][Y];}return this;},unsetCSS:function(b,a){var c=U[b],Y=!a,d,Z;if(c){if(!Y){if(!C.Lang.isArray(a)){a=[a];}B.cssText=c.style.cssText;for(Z=a.length-1;Z>=0;--Z){L(B,a[Z]);}if(B.cssText){c.style.cssText=B.cssText;}else{Y=true;}}if(Y){d=V[N];for(Z=d.length-1;Z>=0;--Z){if(d[Z]===c){delete U[b];Q(Z);break;}}}}return this;}},true);};F=function(M,O){var N=M.styleFloat||M.cssFloat||M["float"],P;B.cssText=O||"";if(N&&!M[K]){M=C.merge(M);delete M.styleFloat;delete M.cssFloat;delete M["float"];M[K]=N;}for(P in M){if(M.hasOwnProperty(P)){B[P]=M[P];}}return B.cssText;};C.StyleSheet.toCssText=("opacity" in B)?F:function(M,N){if("opacity" in M){M=C.merge(M,{filter:"alpha(opacity="+(M.opacity*100)+")"});delete M.opacity;}return F(M,N);};C.StyleSheet.register=function(M,N){return !!(M&&N instanceof C.StyleSheet&&!G[M]&&(G[M]=N));};},"@VERSION@");