dom-style-min.js revision 76ff63d988d2575dc0017b60275806b2fea47341
YUI.add("dom-style",function(B){var k="documentElement",Z="defaultView",N="ownerDocument",l="style",g="float",C="cssFloat",S="styleFloat",T="transparent",n="visible",G="width",a="height",J="borderTopWidth",f="borderRightWidth",D="borderBottomWidth",d="borderLeftWidth",m="getComputedStyle",F=B.config.doc,b=undefined,c=/color$/i;B.mix(B.DOM,{CUSTOM_STYLES:{},setStyle:function(r,Y,s){var q=r[l],e=B.DOM.CUSTOM_STYLES;if(q){if(s===null){s="";}if(Y in e){if(e[Y].set){e[Y].set(r,s,q);return;}else{if(typeof e[Y]==="string"){Y=e[Y];}}}q[Y]=s;}},getStyle:function(r,Y){var q=r[l],e=B.DOM.CUSTOM_STYLES,s="";if(q){if(Y in e){if(e[Y].get){return e[Y].get(r,Y,q);}else{if(typeof e[Y]==="string"){Y=e[Y];}}}s=q[Y];if(s===""){s=B.DOM[m](r,Y);}}return s;},setStyles:function(Y,e){B.each(e,function(q,r){B.DOM.setStyle(Y,r,q);},B.DOM);},getComputedStyle:function(e,Y){var r="",q=e[N];if(e[l]){r=q[Z][m](e,"")[Y];}return r;}});if(F[k][l][C]!==b){B.DOM.CUSTOM_STYLES[g]=C;}else{if(F[k][l][S]!==b){B.DOM.CUSTOM_STYLES[g]=S;}}if(B.UA.opera){B.DOM[m]=function(q,e){var Y=q[N][Z],r=Y[m](q,"")[e];if(c.test(e)){r=B.Color.toRGB(r);}return r;};}if(B.UA.webkit){B.DOM[m]=function(q,e){var Y=q[N][Z],r=Y[m](q,"")[e];if(r==="rgba(0, 0, 0, 0)"){r=T;}return r;};}var A="toString",R=parseInt,Q=RegExp;B.Color={KEYWORDS:{black:"000",silver:"c0c0c0",gray:"808080",white:"fff",maroon:"800000",red:"f00",purple:"800080",fuchsia:"f0f",green:"008000",lime:"0f0",olive:"808000",yellow:"ff0",navy:"000080",blue:"00f",teal:"008080",aqua:"0ff"},re_RGB:/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,re_hex:/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,re_hex3:/([0-9A-F])/gi,toRGB:function(Y){if(!B.Color.re_RGB.test(Y)){Y=B.Color.toHex(Y);}if(B.Color.re_hex.exec(Y)){Y="rgb("+[R(Q.$1,16),R(Q.$2,16),R(Q.$3,16)].join(", ")+")";}return Y;},toHex:function(s){s=B.Color.KEYWORDS[s]||s;if(B.Color.re_RGB.exec(s)){var q=(Q.$1.length===1)?"0"+Q.$1:Number(Q.$1),e=(Q.$2.length===1)?"0"+Q.$2:Number(Q.$2),Y=(Q.$3.length===1)?"0"+Q.$3:Number(Q.$3);s=[q[A](16),e[A](16),Y[A](16)].join("");}if(s.length<6){s=s.replace(B.Color.re_hex3,"$1$1");}if(s!=="transparent"&&s.indexOf("#")<0){s="#"+s;}return s.toLowerCase();}};var E="clientTop",U="clientLeft",L="parentNode",i="right",V="hasLayout",o="px",I="filter",h="filters",O="opacity",X="auto",M="currentStyle",P=function(Y){return Y[M]||Y[l];};if(document[k][l][O]===b&&document[k][h]){B.DOM.CUSTOM_STYLES[O]={get:function(q){var s=100;try{s=q[h]["DXImageTransform.Microsoft.Alpha"][O];}catch(r){try{s=q[h]("alpha")[O];}catch(Y){}}return s/100;},set:function(e,s,Y){var r,q;if(s===""){q=P(e);r=(O in q)?q[O]:1;s=r;}if(typeof Y[I]=="string"){Y[I]="alpha("+O+"="+s*100+")";if(!e[M]||!e[M][V]){Y.zoom=1;}}}};}try{document.createElement("div").style.height="-1px";}catch(j){B.DOM.CUSTOM_STYLES.height={set:function(e,q,Y){if(parseInt(q,10)>=0){Y["height"]=q;}else{}}};B.DOM.CUSTOM_STYLES.width={set:function(e,q,Y){if(parseInt(q,10)>=0){Y["width"]=q;}else{}}};}var W=/^width|height$/,H=/^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,p={CUSTOM_STYLES:{},get:function(Y,q){var e="",r;if(Y){r=P(Y)[q];if(q===O){e=B.DOM.CUSTOM_STYLES[O].get(Y);}else{if(!r||(r.indexOf&&r.indexOf(o)>-1)){e=r;}else{if(B.DOM.IE.COMPUTED[q]){e=B.DOM.IE.COMPUTED[q](Y,q);}else{if(H.test(r)){e=p.getPixel(Y,q)+o;}else{e=r;}}}}}return e;},getOffset:function(q,v){var s=P(q)[v],Y=v.charAt(0).toUpperCase()+v.substr(1),t="offset"+Y,e="pixel"+Y,u,r="";if(s===X){u=q[t];if(u===b){r=0;}r=u;if(W.test(v)){q[l][v]=u;if(q[t]>u){r=u-(q[t]-u);}q[l][v]=X;}}else{if(s.indexOf("%")>-1){s=q.clientWidth-p.getPixel(q,"paddingRight")-p.getPixel(q,"paddingLeft");}if(!q[l][e]&&!q[l][v]){q[l][v]=s;}r=q[l][e];}return r+o;},getBorderWidth:function(Y,q){var e=null;if(!Y[M]||!Y[M][V]){Y[l].zoom=1;}switch(q){case J:e=Y[E];break;case D:e=Y.offsetHeight-Y.clientHeight-Y[E];break;case d:e=Y[U];break;case f:e=Y.offsetWidth-Y.clientWidth-Y[U];break;}return e+o;},getPixel:function(q,Y){var s=null,e=P(q),t=e[i],r=e[Y];q[l][i]=r;s=q[l].pixelRight;q[l][i]=t;return s;},getMargin:function(q,Y){var r,e=P(q);if(e[Y]==X){r=0;}else{r=p.getPixel(q,Y);}return r+o;},getVisibility:function(e,Y){var q;while((q=e[M])&&q[Y]=="inherit"){e=e[L];}return(q)?q[Y]:n;},getColor:function(e,Y){var q=P(e)[Y];if(!q||q===T){B.DOM.elementByAxis(e,L,null,function(r){q=P(r)[Y];if(q&&q!==T){e=r;return true;}});}return B.Color.toRGB(q);},getBorderColor:function(e,Y){var q=P(e),r=q[Y]||q.color;return B.Color.toRGB(B.Color.toHex(r));}},K={};K[G]=K[a]=p.getOffset;K.color=K.backgroundColor=p.getColor;K[J]=K[f]=K[D]=K[d]=p.getBorderWidth;K.marginTop=K.marginRight=K.marginBottom=K.marginLeft=p.getMargin;K.visibility=p.getVisibility;K.borderColor=K.borderTopColor=K.borderRightColor=K.borderBottomColor=K.borderLeftColor=p.getBorderColor;if(!B.config.win[m]){B.DOM[m]=p.get;}B.namespace("DOM.IE");B.DOM.IE.COMPUTED=K;B.DOM.IE.ComputedStyle=p;},"@VERSION@",{skinnable:false,requires:["dom-base"]});