Skip to content

Commit

Permalink
Mask & NodeList: Moving document size detection from mask to NodeList
Browse files Browse the repository at this point in the history
  • Loading branch information
jakearchibald committed Aug 6, 2009
1 parent 3fe1927 commit 1e6475e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
22 changes: 15 additions & 7 deletions src/dom/dom.js
Expand Up @@ -430,7 +430,7 @@
/*
PrivateMethod: getElmDimention
Gets the size of an element as an integer, not including padding or border
*/
*/
function getElmDimention(elm, cssProp /* (width|height) */) {
var r, // val to return
docElmOrBody = env.standardsMode ? docElm : docBody,
Expand All @@ -444,15 +444,23 @@
env.opera < 9.5 ? (isWidth ? docBody.clientWidth : docBody.clientHeight) :
/* else */ (isWidth ? docElmOrBody.clientWidth : docElmOrBody.clientHeight);

} else if (elm.getElementById) { // is document
}
else if (elm.getElementById) { // is document
r = Math.max(
docBody["scroll" + cssPropCaps],
docBody["offset" + cssPropCaps],
docElm["client" + cssPropCaps],
docElm["scroll" + cssPropCaps],
docElm["offset" + cssPropCaps]
docBody["offset" + cssPropCaps]
)
} else {
// values from the documentElement can be incorrect in IE (6, 7, 8), can return values that are too large
if ( !(glow.env.ie) ) {
r = Math.max(
r,
docElm["client" + cssPropCaps],
docElm["scroll" + cssPropCaps],
docElm["offset" + cssPropCaps]
)
}
}
else {
// get an array of css borders & padding
cssBorderPadding = isWidth ? horizontalBorderPadding : verticalBorderPadding;
r = elm['offset' + cssPropCaps] - parseInt( getCssValue(elm, cssBorderPadding) );
Expand Down
3 changes: 1 addition & 2 deletions src/widgets/mask/mask.js
Expand Up @@ -162,8 +162,7 @@ of &lt;body> which have class "glowNoMask" will be left as children of
that.maskElement.hide();

var newHeight = that.opts.disableScroll ? noScrollContainer.height() : Math.max( body.height(), win.height() ),
// doc.width() doesn't work here, that value includes the maskElement in IE7 (and below), even though it's hidden
newWidth = that.opts.disableScroll ? noScrollContainer.width() : Math.max( win.width(), doc[0].documentElement.scrollWidth, body[0].scrollWidth );
newWidth = that.opts.disableScroll ? noScrollContainer.width() : Math.max( win.width(), doc.width() );

// Work out the required width to set the mask (this is basically the width of the content but without the mask)
that.maskElement.width(newWidth).height(newHeight);
Expand Down

0 comments on commit 1e6475e

Please sign in to comment.