2150 |
mathias |
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");
|
|
|
4 |
|
|
|
5 |
dijit.scrollIntoView = function(/* DomNode */node){
|
|
|
6 |
// summary
|
|
|
7 |
// Scroll the passed node into view, if it is not.
|
|
|
8 |
|
|
|
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
|
|
|
11 |
// not safari either
|
|
|
12 |
// dont like browser sniffs implementations but sometimes you have to use it
|
|
|
13 |
if(dojo.isIE){
|
|
|
14 |
//only call scrollIntoView if there is a scrollbar for this menu,
|
|
|
15 |
//otherwise, scrollIntoView will scroll the window scrollbar
|
|
|
16 |
if(dojo.marginBox(node.parentNode).h <= node.parentNode.scrollHeight){ //PORT was getBorderBox
|
|
|
17 |
node.scrollIntoView(false);
|
|
|
18 |
}
|
|
|
19 |
}else if(dojo.isMozilla){
|
|
|
20 |
node.scrollIntoView(false);
|
|
|
21 |
}else{
|
|
|
22 |
var parent = node.parentNode;
|
|
|
23 |
var parentBottom = parent.scrollTop + dojo.marginBox(parent).h; //PORT was getBorderBox
|
|
|
24 |
var nodeBottom = node.offsetTop + dojo.marginBox(node).h;
|
|
|
25 |
if(parentBottom < nodeBottom){
|
|
|
26 |
parent.scrollTop += (nodeBottom - parentBottom);
|
|
|
27 |
}else if(parent.scrollTop > node.offsetTop){
|
|
|
28 |
parent.scrollTop -= (parent.scrollTop - node.offsetTop);
|
|
|
29 |
}
|
|
|
30 |
}
|
|
|
31 |
};
|
|
|
32 |
|
|
|
33 |
}
|