[Pkg-javascript-commits] [dojo] 03/19: 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:08 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag 1.8.7
in repository dojo.

commit 4d8a85b808a2c2efaf8f0ae904900d101d460c93
Author: Brandon Payton <brandon at happycode.net>
Date:   Tue Feb 25 14:02:10 2014 -0700

    Update dojo/window.scrollIntoView to avoid iOS body scroll reset, fixes #17740
    
    (cherry picked from commit 87a492b78c9738ae0d0e41fe81230b151803e819)
---
 window.js | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/window.js b/window.js
index 3505087..92583fe 100644
--- a/window.js
+++ b/window.js
@@ -148,6 +148,15 @@ define(["./_base/lang", "./sniff", "./_base/window", "./dom", "./dom-geometry",
 						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){
@@ -203,14 +212,14 @@ define(["./_base/lang", "./sniff", "./_base/window", "./dom", "./dom-geometry",
 						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