Only apply scrollWidth/clientWidth for webkit. Other browsers handle it differently.

This commit is contained in:
danzel 2012-10-29 11:06:22 +13:00
parent 126a316916
commit 9b5d25ae7f

View File

@ -52,14 +52,13 @@ L.DomUtil = {
do { do {
if (el === docBody) { break; } if (el === docBody) { break; }
top -= el.scrollTop || 0; top -= el.scrollTop || 0;
left -= el.scrollLeft || 0;
//See https://developer.mozilla.org/en-US/docs/DOM/element.scrollLeft //Webkit handles RTL scrollLeft different to everyone else
// http://www.nczonline.net/blog/2010/08/03/working-with-bidirectional-bidi-text-and-rtl-languages-on-the-web/ // https://code.google.com/p/closure-library/source/browse/trunk/closure/goog/style/bidi.js
if (L.DomUtil.documentIsLtr()) { if (!L.DomUtil.documentIsLtr() && L.Browser.webkit) {
left -= el.scrollLeft || 0; left += el.scrollWidth - el.clientWidth;
} else {
left -= (el.scrollLeft || 0) - el.scrollWidth + el.clientWidth;
} }
el = el.parentNode; el = el.parentNode;