Rev 130 Rev 139
1 /* 1 /*
2 IE7, version 0.9 (alpha) (2005-08-19) 2 IE7, version 0.9 (alpha) (2005-08-19)
3 Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/) 3 Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
4 License: http://creativecommons.org/licenses/LGPL/2.1/ 4 License: http://creativecommons.org/licenses/LGPL/2.1/
5 */ 5 */
6 IE7.addModule("ie7-layout",function(){ie7Layout=this;HEADER+="*{boxSizing:content-box}";this.hasLayout=(appVersion<5.5)?function(e){return e.clientWidth}:function(e){return e.currentStyle.hasLayout};this.boxSizing=function(e){if(!ie7Layout.hasLayout(e)){e.style.height="0cm";if(e.currentStyle.verticalAlign=="auto")e.runtimeStyle.verticalAlign="top";_1(e)}};function _1(e){if(e!=viewport&&e.currentStyle.position!="absolute"){collapseMarginTop(e);collapseMarginBottom(e)}};var firstElementChild=cssQuery.valueOf("firstElementChild");var lastElementChild=cssQuery.valueOf("lastElementChild");function collapseMarginTop(e){if(!e.runtimeStyle.marginTop){var p=e.parentElement;if(p&&ie7Layout.hasLayout(p)&&e==firstElementChild(p))return;var f=firstElementChild(e);if(f&&f.currentStyle.styleFloat=="none"&&ie7Layout.hasLayout(f)){collapseMarginTop(f);m=_3(e,e.currentStyle.marginTop);c=_3(f,f.currentStyle.marginTop);if(m<0||c<0){e.runtimeStyle.marginTop=m+c}else{e.runtimeStyle.marginTop=Math.max(c,m)}f.runtimeStyle.marginTop="0px"}}};eval(String(collapseMarginTop).replace(/Top/g,"Bottom").replace(/first/g,"last"));function _3(e,v){return(v=="auto")?0:getPixelValue(e,v)};var U=/^[.\d][\w%]*$/,A=/^(auto|0cm)$/,N="[.\\d]";var applyWidth,applyHeight;function borderBox(e){applyWidth(e);applyHeight(e)};function fixWidth(H){applyWidth=function(e){if(!PERCENT.test(e.currentStyle.width))fixWidth(e);_1(e)};function fixWidth(e,v){if(!e.runtimeStyle.fixedWidth){if(!v)v=e.currentStyle.width;e.runtimeStyle.fixedWidth=(U.test(v))?Math.max(0,getFixedWidth(e,v)):v;setOverrideStyle(e,"width",e.runtimeStyle.fixedWidth)}};function layoutWidth(e){if(!isFixed(e)){var l=e.offsetParent;while(l&&!ie7Layout.hasLayout(l))l=l.offsetParent}return(l||viewport).clientWidth};function getPixelWidth(e,v){if(PERCENT.test(v))return parseInt(parseFloat(v)/100*layoutWidth(e));return getPixelValue(e,v)};var getFixedWidth=function(e,v){var b=e.currentStyle["box-sizing"]=="border-box";var a=0;if(quirksMode&&!b)a+=getBorderWidth(e)+getPaddingWidth(e);else if(!quirksMode&&b)a-=getBorderWidth(e)+getPaddingWidth(e);return getPixelWidth(e,v)+a};function getBorderWidth(e){return e.offsetWidth-e.clientWidth};function getPaddingWidth(e){return getPixelWidth(e,e.currentStyle.paddingLeft)+getPixelWidth(e,e.currentStyle.paddingRight)};eval(String(getPaddingWidth).replace(/padding/g,"margin").replace(/Padding/g,"Margin"));HEADER+="*{minWidth:none;maxWidth:none;min-width:none;max-width:none}";function minWidth(e){if(e.currentStyle["min-width"]!=null){e.style.minWidth=e.currentStyle["min-width"]}if(register(minWidth,e,e.currentStyle.minWidth!="none")){ie7Layout.boxSizing(e);fixWidth(e);resizeWidth(e)}};eval(String(minWidth).replace(/min/g,"max"));ie7Layout.minWidth=minWidth;ie7Layout.maxWidth=maxWidth;function resizeWidth(e){var r=e.getBoundingClientRect();var w=r.right-r.left;if(e.currentStyle.minWidth!="none"&&w<=getFixedWidth(e,e.currentStyle.minWidth)){e.runtimeStyle.width=getFixedWidth(e,e.currentStyle.minWidth)}else if(e.currentStyle.maxWidth!="none"&&w>=getFixedWidth(e,e.currentStyle.maxWidth)){e.runtimeStyle.width=getFixedWidth(e,e.currentStyle.maxWidth)}else{e.runtimeStyle.width=e.runtimeStyle.fixedWidth}};function fixRight(e){if(register(fixRight,e,/^(fixed|absolute)$/.test(e.currentStyle.position)&&getDefinedStyle(e,"left")!="auto"&&getDefinedStyle(e,"right")!="auto"&&A.test(getDefinedStyle(e,"width")))){resizeRight(e);ie7Layout.boxSizing(e)}};ie7Layout.fixRight=fixRight;function resizeRight(e){var l=getPixelWidth(e,e.runtimeStyle._4||e.currentStyle.left);var w=layoutWidth(e)-getPixelWidth(e,e.currentStyle.right)-l-getMarginWidth(e);if(parseInt(e.runtimeStyle.width)==w)return;e.runtimeStyle.width="";if(isFixed(e)||H||e.offsetWidth<w){if(!quirksMode)w-=getBorderWidth(e)+getPaddingWidth(e);if(w<0)w=0;e.runtimeStyle.fixedWidth=w;setOverrideStyle(e,"width",w)}};var _2=0;addResize(function(){var i,w=(_2<viewport.clientWidth);_2=viewport.clientWidth;for(i in minWidth.elements){var e=minWidth.elements[i];var f=(parseInt(e.runtimeStyle.width)==getFixedWidth(e,e.currentStyle.minWidth));if(w&&f)e.runtimeStyle.width="";if(w==f)resizeWidth(e)}for(i in maxWidth.elements){var e=maxWidth.elements[i];var f=(parseInt(e.runtimeStyle.width)==getFixedWidth(e,e.currentStyle.maxWidth));if(!w&&f)e.runtimeStyle.width="";if(w!=f)resizeWidth(e)}for(i in fixRight.elements)resizeRight(fixRight.elements[i])});if(window.IE7_BOX_MODEL!==false){ie7CSS.addRecalc("width",N,quirksMode?applyWidth:_1)}ie7CSS.addRecalc("min-width",N,minWidth);ie7CSS.addRecalc("max-width",N,maxWidth);ie7CSS.addRecalc("right",N,fixRight)};ie7CSS.addRecalc("border-spacing",N,function(e){if(e.currentStyle.borderCollapse!="collapse"){e.cellSpacing=getPixelValue(e,e.currentStyle["border-spacing"])}});ie7CSS.addRecalc("box-sizing","content-box",this.boxSizing);ie7CSS.addRecalc("box-sizing","border-box",borderBox);var _0=new ParseMaster;_0.add(/Width/,"Height");_0.add(/width/,"height");_0.add(/Left/,"Top");_0.add(/left/,"top");_0.add(/Right/,"Bottom");_0.add(/right/,"bottom");eval(_0.exec(String(fixWidth)));fixWidth();fixHeight(true)}); 6 IE7.addModule("ie7-layout",function(){ie7Layout=this;HEADER+="*{boxSizing:content-box}";this.hasLayout=(appVersion<5.5)?function(e){return e.clientWidth}:function(e){return e.currentStyle.hasLayout};this.boxSizing=function(e){if(!ie7Layout.hasLayout(e)){e.style.height="0cm";if(e.currentStyle.verticalAlign=="auto")e.runtimeStyle.verticalAlign="top";_1(e)}};function _1(e){if(e!=viewport&&e.currentStyle.position!="absolute"){collapseMarginTop(e);collapseMarginBottom(e)}};var firstElementChild=cssQuery.valueOf("firstElementChild");var lastElementChild=cssQuery.valueOf("lastElementChild");function collapseMarginTop(e){if(!e.runtimeStyle.marginTop){var p=e.parentElement;if(p&&ie7Layout.hasLayout(p)&&e==firstElementChild(p))return;var f=firstElementChild(e);if(f&&f.currentStyle.styleFloat=="none"&&ie7Layout.hasLayout(f)){collapseMarginTop(f);m=_3(e,e.currentStyle.marginTop);c=_3(f,f.currentStyle.marginTop);if(m<0||c<0){e.runtimeStyle.marginTop=m+c}else{e.runtimeStyle.marginTop=Math.max(c,m)}f.runtimeStyle.marginTop="0px"}}};eval(String(collapseMarginTop).replace(/Top/g,"Bottom").replace(/first/g,"last"));function _3(e,v){return(v=="auto")?0:getPixelValue(e,v)};var U=/^[.\d][\w%]*$/,A=/^(auto|0cm)$/,N="[.\\d]";var applyWidth,applyHeight;function borderBox(e){applyWidth(e);applyHeight(e)};function fixWidth(H){applyWidth=function(e){if(!PERCENT.test(e.currentStyle.width))fixWidth(e);_1(e)};function fixWidth(e,v){if(!e.runtimeStyle.fixedWidth){if(!v)v=e.currentStyle.width;e.runtimeStyle.fixedWidth=(U.test(v))?Math.max(0,getFixedWidth(e,v)):v;setOverrideStyle(e,"width",e.runtimeStyle.fixedWidth)}};function layoutWidth(e){if(!isFixed(e)){var l=e.offsetParent;while(l&&!ie7Layout.hasLayout(l))l=l.offsetParent}return(l||viewport).clientWidth};function getPixelWidth(e,v){if(PERCENT.test(v))return parseInt(parseFloat(v)/100*layoutWidth(e));return getPixelValue(e,v)};var getFixedWidth=function(e,v){var b=e.currentStyle["box-sizing"]=="border-box";var a=0;if(quirksMode&&!b)a+=getBorderWidth(e)+getPaddingWidth(e);else if(!quirksMode&&b)a-=getBorderWidth(e)+getPaddingWidth(e);return getPixelWidth(e,v)+a};function getBorderWidth(e){return e.offsetWidth-e.clientWidth};function getPaddingWidth(e){return getPixelWidth(e,e.currentStyle.paddingLeft)+getPixelWidth(e,e.currentStyle.paddingRight)};eval(String(getPaddingWidth).replace(/padding/g,"margin").replace(/Padding/g,"Margin"));HEADER+="*{minWidth:none;maxWidth:none;min-width:none;max-width:none}";function minWidth(e){if(e.currentStyle["min-width"]!=null){e.style.minWidth=e.currentStyle["min-width"]}if(register(minWidth,e,e.currentStyle.minWidth!="none")){ie7Layout.boxSizing(e);fixWidth(e);resizeWidth(e)}};eval(String(minWidth).replace(/min/g,"max"));ie7Layout.minWidth=minWidth;ie7Layout.maxWidth=maxWidth;function resizeWidth(e){var r=e.getBoundingClientRect();var w=r.right-r.left;if(e.currentStyle.minWidth!="none"&&w<=getFixedWidth(e,e.currentStyle.minWidth)){e.runtimeStyle.width=getFixedWidth(e,e.currentStyle.minWidth)}else if(e.currentStyle.maxWidth!="none"&&w>=getFixedWidth(e,e.currentStyle.maxWidth)){e.runtimeStyle.width=getFixedWidth(e,e.currentStyle.maxWidth)}else{e.runtimeStyle.width=e.runtimeStyle.fixedWidth}};function fixRight(e){if(register(fixRight,e,/^(fixed|absolute)$/.test(e.currentStyle.position)&&getDefinedStyle(e,"left")!="auto"&&getDefinedStyle(e,"right")!="auto"&&A.test(getDefinedStyle(e,"width")))){resizeRight(e);ie7Layout.boxSizing(e)}};ie7Layout.fixRight=fixRight;function resizeRight(e){var l=getPixelWidth(e,e.runtimeStyle._4||e.currentStyle.left);var w=layoutWidth(e)-getPixelWidth(e,e.currentStyle.right)-l-getMarginWidth(e);if(parseInt(e.runtimeStyle.width)==w)return;e.runtimeStyle.width="";if(isFixed(e)||H||e.offsetWidth<w){if(!quirksMode)w-=getBorderWidth(e)+getPaddingWidth(e);if(w<0)w=0;e.runtimeStyle.fixedWidth=w;setOverrideStyle(e,"width",w)}};var _2=0;addResize(function(){var i,w=(_2<viewport.clientWidth);_2=viewport.clientWidth;for(i in minWidth.elements){var e=minWidth.elements[i];var f=(parseInt(e.runtimeStyle.width)==getFixedWidth(e,e.currentStyle.minWidth));if(w&&f)e.runtimeStyle.width="";if(w==f)resizeWidth(e)}for(i in maxWidth.elements){var e=maxWidth.elements[i];var f=(parseInt(e.runtimeStyle.width)==getFixedWidth(e,e.currentStyle.maxWidth));if(!w&&f)e.runtimeStyle.width="";if(w!=f)resizeWidth(e)}for(i in fixRight.elements)resizeRight(fixRight.elements[i])});if(window.IE7_BOX_MODEL!==false){ie7CSS.addRecalc("width",N,quirksMode?applyWidth:_1)}ie7CSS.addRecalc("min-width",N,minWidth);ie7CSS.addRecalc("max-width",N,maxWidth);ie7CSS.addRecalc("right",N,fixRight)};ie7CSS.addRecalc("border-spacing",N,function(e){if(e.currentStyle.borderCollapse!="collapse"){e.cellSpacing=getPixelValue(e,e.currentStyle["border-spacing"])}});ie7CSS.addRecalc("box-sizing","content-box",this.boxSizing);ie7CSS.addRecalc("box-sizing","border-box",borderBox);var _0=new ParseMaster;_0.add(/Width/,"Height");_0.add(/width/,"height");_0.add(/Left/,"Top");_0.add(/left/,"top");_0.add(/Right/,"Bottom");_0.add(/right/,"bottom");eval(_0.exec(String(fixWidth)));fixWidth();fixHeight(true)});