diff options
Diffstat (limited to 'lib/dojo/window.js')
-rw-r--r-- | lib/dojo/window.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/dojo/window.js b/lib/dojo/window.js index c36eb4c23..4e363faba 100644 --- a/lib/dojo/window.js +++ b/lib/dojo/window.js @@ -1,5 +1,5 @@ /* - Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. + Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ @@ -9,6 +9,8 @@ if(!dojo._hasResource["dojo.window"]){ //_hasResource checks added by build. Do dojo._hasResource["dojo.window"] = true; dojo.provide("dojo.window"); +dojo.getObject("window", true, dojo); + dojo.window.getBox = function(){ // summary: // Returns the dimensions and scroll position of the viewable area of a browser window @@ -62,7 +64,9 @@ dojo.window.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){ return; } var backCompat = doc.compatMode == 'BackCompat', - clientAreaRoot = backCompat? body : html, + clientAreaRoot = (isIE >= 9 && node.ownerDocument.parentWindow.frameElement) + ? ((html.clientHeight > 0 && html.clientWidth > 0 && (body.clientHeight == 0 || body.clientWidth == 0 || body.clientHeight > html.clientHeight || body.clientWidth > html.clientWidth)) ? html : body) + : (backCompat ? body : html), scrollRoot = isWK ? body : clientAreaRoot, rootWidth = clientAreaRoot.clientWidth, rootHeight = clientAreaRoot.clientHeight, @@ -87,14 +91,11 @@ dojo.window.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){ }else{ var pb = dojo._getPadBorderExtents(el); elPos.w -= pb.w; elPos.h -= pb.h; elPos.x += pb.l; elPos.y += pb.t; - } - - if(el != scrollRoot){ // body, html sizes already have the scrollbar removed var clientSize = el.clientWidth, scrollBarSize = elPos.w - clientSize; if(clientSize > 0 && scrollBarSize > 0){ elPos.w = clientSize; - if(isIE && rtl){ elPos.x += scrollBarSize; } + elPos.x += (rtl && (isIE || el.clientLeft > pb.l/*Chrome*/)) ? scrollBarSize : 0; } clientSize = el.clientHeight; scrollBarSize = elPos.h - clientSize; @@ -123,8 +124,9 @@ dojo.window.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){ bot = t + nodePos.h - elPos.h; // beyond bottom: > 0 if(r * l > 0){ var s = Math[l < 0? "max" : "min"](l, r); + if(rtl && ((isIE == 8 && !backCompat) || isIE >= 9)){ s = -s; } nodePos.x += el.scrollLeft; - el.scrollLeft += (isIE >= 8 && !backCompat && rtl)? -s : s; + el.scrollLeft += s; nodePos.x -= el.scrollLeft; } if(bot * t > 0){ @@ -133,7 +135,7 @@ dojo.window.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){ nodePos.y -= el.scrollTop; } el = (el != scrollRoot) && !fixedPos && el.parentNode; - } + } }catch(error){ console.error('scrollIntoView: ' + error); node.scrollIntoView(false); |