1 if(!dojo._hasResource["dijit._base.scroll"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dijit._base.scroll"] = true;
3 dojo.provide("dijit._base.scroll");
5 dijit.scrollIntoView = function(/* DomNode */node){
7 // Scroll the passed node into view, if it is not.
9 // don't rely on that node.scrollIntoView works just because the function is there
10 // it doesnt work in Konqueror or Opera even though the function is there and probably
12 // native scrollIntoView() causes FF3's whole window to scroll if there is no scroll bar
13 // on the immediate parent
14 // dont like browser sniffs implementations but sometimes you have to use it
15 // #6146: IE scrollIntoView is broken
16 // It's not enough just to scroll the menu node into view if
17 // node.scrollIntoView hides part of the parent's scrollbar,
18 // so just manage the parent scrollbar ourselves
19 var parent = node.parentNode;
20 var parentBottom = parent.scrollTop + dojo.marginBox(parent).h; //PORT was getBorderBox
21 var nodeBottom = node.offsetTop + dojo.marginBox(node).h;
22 if(parentBottom < nodeBottom){
23 parent.scrollTop += (nodeBottom - parentBottom);
24 }else if(parent.scrollTop > node.offsetTop){
25 parent.scrollTop -= (parent.scrollTop - node.offsetTop);