commit
ae7561ec6b
@ -1,7 +1,9 @@
|
||||
(function () {
|
||||
|
||||
var ie = !!window.ActiveXObject,
|
||||
// http://tanalin.com/en/articles/ie-version-js/
|
||||
ie6 = ie && !window.XMLHttpRequest,
|
||||
ie7 = ie && !document.querySelector,
|
||||
|
||||
// terrible browser detection to work around Safari / iOS / Android browser bugs
|
||||
// see TileLayer._addTile and debug/hacks/jitter.html
|
||||
@ -56,6 +58,7 @@
|
||||
|
||||
L.Browser = {
|
||||
ie6: ie6,
|
||||
ie7: ie7,
|
||||
webkit: webkit,
|
||||
|
||||
android: android,
|
||||
|
@ -15,7 +15,7 @@ L.DomUtil = {
|
||||
value = el.currentStyle[style];
|
||||
}
|
||||
|
||||
if (!value || value === 'auto') {
|
||||
if ((!value || value === 'auto') && document.defaultView) {
|
||||
var css = document.defaultView.getComputedStyle(el, null);
|
||||
value = css ? css[style] : null;
|
||||
}
|
||||
@ -29,7 +29,8 @@ L.DomUtil = {
|
||||
left = 0,
|
||||
el = element,
|
||||
docBody = document.body,
|
||||
pos;
|
||||
pos,
|
||||
ie7 = L.Browser.ie7;
|
||||
|
||||
do {
|
||||
top += el.offsetTop || 0;
|
||||
@ -53,13 +54,18 @@ L.DomUtil = {
|
||||
if (el === docBody) { break; }
|
||||
|
||||
top -= el.scrollTop || 0;
|
||||
|
||||
//See https://developer.mozilla.org/en-US/docs/DOM/element.scrollLeft
|
||||
// http://www.nczonline.net/blog/2010/08/03/working-with-bidirectional-bidi-text-and-rtl-languages-on-the-web/
|
||||
if (L.DomUtil.getStyle(el, 'direction') == "ltr") {
|
||||
left -= el.scrollLeft || 0;
|
||||
} else {
|
||||
left -= (el.scrollLeft || 0) - el.scrollWidth + el.clientWidth;
|
||||
|
||||
//Webkit (and ie <= 7) handles RTL scrollLeft different to everyone else
|
||||
// https://code.google.com/p/closure-library/source/browse/trunk/closure/goog/style/bidi.js
|
||||
if (!L.DomUtil.documentIsLtr() && (L.Browser.webkit || ie7)) {
|
||||
left += el.scrollWidth - el.clientWidth;
|
||||
|
||||
//ie7 shows the scrollbar by default and provides clientWidth counting it, so we need to add it back in if it is visible
|
||||
// Scrollbar is on the left as we are RTL
|
||||
if (ie7 && L.DomUtil.getStyle(el, 'overflow-y') !== 'hidden' && L.DomUtil.getStyle(el, 'overflow') !== 'hidden') {
|
||||
left += 17;
|
||||
}
|
||||
}
|
||||
|
||||
el = el.parentNode;
|
||||
@ -68,6 +74,14 @@ L.DomUtil = {
|
||||
return new L.Point(left, top);
|
||||
},
|
||||
|
||||
documentIsLtr: function () {
|
||||
if (!L.DomUtil._docIsLtrCached) {
|
||||
L.DomUtil._docIsLtrCached = true;
|
||||
L.DomUtil._docIsLtr = L.DomUtil.getStyle(document.body, 'direction') === "ltr";
|
||||
}
|
||||
return L.DomUtil._docIsLtr;
|
||||
},
|
||||
|
||||
create: function (tagName, className, container) {
|
||||
|
||||
var el = document.createElement(tagName);
|
||||
|
Loading…
Reference in New Issue
Block a user