summaryrefslogtreecommitdiffstats
path: root/js/yui3/dom-style-ie/dom-style-ie-min.js
blob: 4c2b8b16aadb5a72e3012698c127ef4008b33d3c (plain)
1
2
3
4
5
6
7
8
/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/

YUI.add("dom-style-ie",function(e,t){var n="hasLayout",r="px",i="filter",s="filters",o="opacity",u="auto",a="borderWidth",f="borderTopWidth",l="borderRightWidth",c="borderBottomWidth",h="borderLeftWidth",p="width",d="height",v="transparent",m="visible",g="getComputedStyle",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,n){var i="",s;return t&&(s=x(t)[n],n===o&&e.DOM.CUSTOM_STYLES[o]?i=e.DOM.CUSTOM_STYLES[o].get(t):!s||s.indexOf&&s.indexOf(r)>-1?i=s:e.DOM.IE.COMPUTED[n]?i=e.DOM.IE.COMPUTED[n](t,n):E.test(s)?i=T.getPixel(t,n)+r:i=s),i},sizeOffsets:{width:["Left","Right"],height:["Top","Bottom"],top:["Top"],bottom:["Bottom"]},getOffset:function(e,t){var n=x(e)[t],i=t.charAt(0).toUpperCase()+t.substr(1),s="pixel"+i,o=T.sizeOffsets[t],a=e.ownerDocument.compatMode,f="";return n===u||n.indexOf("%")>-1?(f=e["offset"+i],a!=="BackCompat"&&(o[0]&&(f-=T.getPixel(e,"padding"+o[0]),f-=T.getBorderWidth(e,"border"+o[0]+"Width",1)),o[1]&&(f-=T.getPixel(e,"padding"+o[1]),f-=T.getBorderWidth(e,"border"+o[1]+"Width",1)))):(!e.style[s]&&!e.style[t]&&(e.style[t]=n),f=e.style[s]),f+r},borderMap:{thin:S?"1px":"2px",medium:S?"3px":"4px",thick:S?"5px":"6px"},getBorderWidth:function(e,t,n){var i=e.currentStyle[t];return i.indexOf(r)<0&&(T.borderMap[i]&&e.currentStyle.borderStyle!=="none"?i=T.borderMap[i]:i=0),n?parseFloat(i):i},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 n,i=x(e);return i[t]===u?n=0:n=T.getPixel(e,t),n+r},getVisibility:function(e,t){var n;while((n=e.currentStyle)&&n[t]==="inherit")e=e.parentNode;return n?n[t]:m},getColor:function(t,n){var r=x(t)[n];return(!r||r===v)&&e.DOM.elementByAxis(t,"parentNode",null,function(e){r=x(e)[n];if(r&&r!==v)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[o]={get:function(e){var t=100;try{t=e[s]["DXImageTransform.Microsoft.Alpha"][o]}catch(n){try{t=e[s]("alpha")[o]}catch(r){}}return t/100},set:function(e,t,r){var s,u=x(e),a=u[i];r=r||e.style,t===""&&(s=o in u?u[o]:1,t=s),typeof a=="string"&&(r[i]=a.replace(/alpha([^)]*\))/gi,"")+(t<=1?"alpha("+o+"="+t*100+")":""),r[i]||r.removeAttribute(i),u[n]||(r.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[p]=N[d]=T.getOffset,N.color=N.backgroundColor=T.getColor,N[a]=N[f]=N[l]=N[c]=N[h]=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[g]=T.get,e.namespace("DOM.IE"),e.DOM.IE.COMPUTED=N,e.DOM.IE.ComputedStyle=T)},"3.17.2",{requires:["dom-style","color-base"]});