[Pkg-javascript-commits] [dojo] 08/27: Update dojo/window.scrollIntoView to avoid iOS body scroll reset, fixes #17740
David Prévot
taffit at moszumanska.debian.org
Sun Sep 14 16:23:05 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.7.6
in repository dojo.
commit 1f3bda74546110fd0e1a7ddbd29a67abe28a6ed6
Author: Brandon Payton <brandon at happycode.net>
Date: Tue Mar 25 17:47:21 2014 -0700
Update dojo/window.scrollIntoView to avoid iOS body scroll reset, fixes #17740
(cherry picked from commit 87a492b78c9738ae0d0e41fe81230b151803e819)
(backported by hand due to conflicts)
---
window.js | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/window.js b/window.js
index f7aa3ad..4bafc0b 100644
--- a/window.js
+++ b/window.js
@@ -152,6 +152,15 @@ window.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){
return (isIE <= 6 || (isIE == 7 && backCompat))
? false
: (has("position-fixed-support") && (style.get(el, 'position').toLowerCase() == "fixed"));
+ },
+ self = this,
+ scrollElementBy = function(el, x, y){
+ if(el.tagName == "BODY" || el.tagName == "HTML"){
+ self.get(el.ownerDocument).scrollBy(x, y);
+ }else{
+ x && (el.scrollLeft += x);
+ y && (el.scrollTop += y);
+ }
};
if(isFixed(node)){ return; } // nothing to do
while(el){
@@ -207,14 +216,14 @@ window.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){
s = Math[l < 0? "max" : "min"](l, r);
if(rtl && ((isIE == 8 && !backCompat) || isIE >= 9)){ s = -s; }
old = el.scrollLeft;
- el.scrollLeft += s;
+ scrollElementBy(el, s, 0);
s = el.scrollLeft - old;
nodePos.x -= s;
}
if(bot * t > 0 && (!!el.scrollTop || el == scrollRoot || el.scrollHeight > el.offsetHeight)){
s = Math.ceil(Math[t < 0? "max" : "min"](t, bot));
old = el.scrollTop;
- el.scrollTop += s;
+ scrollElementBy(el, 0, s);
s = el.scrollTop - old;
nodePos.y -= s;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list