summaryrefslogtreecommitdiffstats
path: root/js/yui3/dom-style-ie/dom-style-ie-min.js
blob: 62a4046882e9f9a6a3c972480e8ac41a07571ae2 (plain)
1
2
3
4
5
6
7
/*
YUI 3.7.3 (build 5687)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("dom-style-ie",function(e,t){(function(e){var t="hasLayout",n="px",r="filter",i="filters",s="opacity",o="auto",u="borderWidth",a="borderTopWidth",f="borderRightWidth",l="borderBottomWidth",c="borderLeftWidth",h="width",p="height",d="transparent",v="visible",m="getComputedStyle",g=undefined,y=e.config.doc.documentElement,b=e.Features.test,w=e.Features.add,E=/^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,S=e.UA.ie>=8,x=function(e){return e.currentStyle||e.style},T={CUSTOM_STYLES:{},get:function(t,r){var i="",o;return t&&(o=x(t)[r],r===s&&e.DOM.CUSTOM_STYLES[s]?i=e.DOM.CUSTOM_STYLES[s].get(t):!o||o.indexOf&&o.indexOf(n)>-1?i=o:e.DOM.IE.COMPUTED[r]?i=e.DOM.IE.COMPUTED[r](t,r):E.test(o)?i=T.getPixel(t,r)+n:i=o),i},sizeOffsets:{width:["Left","Right"],height:["Top","Bottom"],top:["Top"],bottom:["Bottom"]},getOffset:function(e,t){var r=x(e)[t],i=t.charAt(0).toUpperCase()+t.substr(1),s="offset"+i,u="pixel"+i,a=T.sizeOffsets[t],f=e.ownerDocument.compatMode,l="";return r===o||r.indexOf("%")>-1?(l=e["offset"+i],f!=="BackCompat"&&(a[0]&&(l-=T.getPixel(e,"padding"+a[0]),l-=T.getBorderWidth(e,"border"+a[0]+"Width",1)),a[1]&&(l-=T.getPixel(e,"padding"+a[1]),l-=T.getBorderWidth(e,"border"+a[1]+"Width",1)))):(!e.style[u]&&!e.style[t]&&(e.style[t]=r),l=e.style[u]),l+n},borderMap:{thin:S?"1px":"2px",medium:S?"3px":"4px",thick:S?"5px":"6px"},getBorderWidth:function(e,t,r){var i=r?"":n,s=e.currentStyle[t];return s.indexOf(n)<0&&(T.borderMap[s]&&e.currentStyle.borderStyle!=="none"?s=T.borderMap[s]:s=0),r?parseFloat(s):s},getPixel:function(e,t){var n=null,r=x(e),i=r.right,s=r[t];return e.style.right=s,n=e.style.pixelRight,e.style.right=i,n},getMargin:function(e,t){var r,i=x(e);return i[t]==o?r=0:r=T.getPixel(e,t),r+n},getVisibility:function(e,t){var n;while((n=e.currentStyle)&&n[t]=="inherit")e=e.parentNode;return n?n[t]:v},getColor:function(t,n){var r=x(t)[n];return(!r||r===d)&&e.DOM.elementByAxis(t,"parentNode",null,function(e){r=x(e)[n];if(r&&r!==d)return t=e,!0}),e.Color.toRGB(r)},getBorderColor:function(t,n){var r=x(t),i=r[n]||r.color;return e.Color.toRGB(e.Color.toHex(i))}},N={};w("style","computedStyle",{test:function(){return"getComputedStyle"in e.config.win}}),w("style","opacity",{test:function(){return"opacity"in y.style}}),w("style","filter",{test:function(){return"filters"in y}}),!b("style","opacity")&&b("style","filter")&&(e.DOM.CUSTOM_STYLES[s]={get:function(e){var t=100;try{t=e[i]["DXImageTransform.Microsoft.Alpha"][s]}catch(n){try{t=e[i]("alpha")[s]}catch(r){}}return t/100},set:function(e,n,i){var o,u=x(e),a=u[r];i=i||e.style,n===""&&(o=s in u?u[s]:1,n=o),typeof a=="string"&&(i[r]=a.replace(/alpha([^)]*\))/gi,"")+(n<1?"alpha("+s+"="+n*100+")":""),i[r]||i.removeAttribute(r),u[t]||(i.zoom=1))}});try{e.config.doc.createElement("div").style.height="-1px"}catch(C){e.DOM.CUSTOM_STYLES.height={set:function(e,t,n){var r=parseFloat(t);if(r>=0||t==="auto"||t==="")n.height=t}},e.DOM.CUSTOM_STYLES.width={set:function(e,t,n){var r=parseFloat(t);if(r>=0||t==="auto"||t==="")n.width=t}}}b("style","computedStyle")||(N[h]=N[p]=T.getOffset,N.color=N.backgroundColor=T.getColor,N[u]=N[a]=N[f]=N[l]=N[c]=T.getBorderWidth,N.marginTop=N.marginRight=N.marginBottom=N.marginLeft=T.getMargin,N.visibility=T.getVisibility,N.borderColor=N.borderTopColor=N.borderRightColor=N.borderBottomColor=N.borderLeftColor=T.getBorderColor,e.DOM[m]=T.get,e.namespace("DOM.IE"),e.DOM.IE.COMPUTED=N,e.DOM.IE.ComputedStyle=T)})(e)},"3.7.3",{requires:["dom-style"]});