stylesheet-min.js revision 00f5227c72bff2a1b314aff7ee1829c303e74462
YUI.add("stylesheet",function(C){var H=C.config.doc,D=H.createElement("p"),B=D.style,G={},I=("cssFloat" in B)?"cssFloat":"styleFloat",E,A,J;A=("opacity" in B)?function(K){K.opacity="";}:function(K){K.filter="";};B.border="1px solid red";B.border="";J=B.borderLeft?function(K,M){var L;if(M!==I&&M.toLowerCase().indexOf("float")!=-1){M=I;}if(typeof K[M]==="string"){switch(M){case"opacity":case"filter":A(K);break;case"font":K.font=K.fontStyle=K.fontVariant=K.fontWeight=K.fontSize=K.lineHeight=K.fontFamily="";break;default:for(L in K){if(L.indexOf(M)===0){K[L]="";}}}}}:function(K,L){if(L!==I&&L.toLowerCase().indexOf("float")!=-1){L=I;}if(C.Lang.isString(K[L])){if(L==="opacity"){A(K);}else{K[L]="";}}};function F(R,M){var U,P,T,S={},L,V,O;if(!(this instanceof arguments.callee)){return new arguments.callee(R,M);}U=H.getElementsByTagName("head")[0];if(!U){C.fail("HEAD element not found to append STYLE node");}P=R&&(R.nodeName?R:H.getElementById(R.replace(/^#/,"")));if(R&&G[R]){return G[R];}else{if(P&&G[C.stamp(P)]){return G[C.stamp(P)];}}if(!P||!/^(?:style|link)$/i.test(P.nodeName)){P=H.createElement("style");P.type="text/css";}if(typeof R==="string"){if(R.indexOf("{")!=-1){if(P.styleSheet){P.styleSheet.cssText=R;}else{P.appendChild(H.createTextNode(R));}}else{if(!M){M=R;}}}if(P.parentNode!==U){U.appendChild(P);}T=P.sheet||P.styleSheet;L=("cssRules" in T)?"cssRules":"rules";O=("deleteRule" in T)?function(W){T.deleteRule(W);}:function(W){T.removeRule(W);};V=("insertRule" in T)?function(Y,X,W){T.insertRule(Y+" "+X,W);}:function(Y,X,W){T.addRule(Y,X,W);};var Q,K,N;for(Q=T[L].length-1;Q>=0;--Q){K=T[L][Q];N=K.selectorText;if(S[N]){S[N].style.cssText+=";"+K.style.cssText;O(Q);}else{S[N]=K;}}F.register(C.stamp(P),this);if(M){F.register(M,this);}C.mix(this,{getId:function(){return C.stamp(P);},enable:function(){T.disabled=false;return this;},disable:function(){T.disabled=true;return this;},isEnabled:function(){return !T.disabled;},set:function(Z,Y){var b=S[Z],a=Z.split(/\s*,\s*/),X,W;if(a.length>1){for(X=a.length-1;X>=0;--X){this.set(a[X],Y);}return this;}if(!F.isValidSelector(Z)){return this;}if(b){b.style.cssText=F.toCssText(Y,b.style.cssText);}else{W=T[L].length;V(Z,"{"+F.toCssText(Y)+"}",W);S[Z]=T[L][W];}return this;},unset:function(Z,Y){var a=S[Z],W=!Y,b,X;if(a){if(!W){Y=C.Array(Y);B.cssText=a.style.cssText;for(X=Y.length-1;X>=0;--X){J(B,Y[X]);}if(B.cssText){a.style.cssText=B.cssText;}else{W=true;}}if(W){b=T[L];for(X=b.length-1;X>=0;--X){if(b[X]===a){delete S[Z];O(X);break;}}}}return this;}},true);}E=function(K,M){var L=K.styleFloat||K.cssFloat||K["float"],O;B.cssText=M||"";if(L&&!K[I]){K=C.merge(K);delete K.styleFloat;delete K.cssFloat;delete K["float"];K[I]=L;}for(O in K){if(K.hasOwnProperty(O)){try{B[O]=C.Lang.trim(K[O]);}catch(N){}}}return B.cssText;};C.mix(F,{toCssText:("opacity" in B)?E:function(K,L){if("opacity" in K){K=C.merge(K,{filter:"alpha(opacity="+(K.opacity*100)+")"});delete K.opacity;}return E(K,L);},register:function(K,L){return !!(K&&L instanceof F&&!G[K]&&(G[K]=L));},isValidSelector:function(K){return !/[^\\][`~!@$%\^&()+=|{}\[\];'"?<]|^\s*[^a-z0-9*#.]|[\s.#][^a-z0-9]/i.test(K);}});C.StyleSheet=F;},"@VERSION@");