Delete ltr/rtl code as its not needed any more, wtf?
This commit is contained in:
parent
b987f0c44b
commit
0c7e7eb373
@ -53,13 +53,6 @@ describe('DomUtil', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#documentIsLtr', function () {
|
|
||||||
it('returns true if doc direction is ltr', function () {
|
|
||||||
expect(L.DomUtil.documentIsLtr()).to.eql(true);
|
|
||||||
expect(L.DomUtil.documentIsLtr()).to.eql(true); // cached
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('#getViewportOffset', function () {
|
describe('#getViewportOffset', function () {
|
||||||
it('calculates the viewport offset of an element', function () {
|
it('calculates the viewport offset of an element', function () {
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
|
@ -144,8 +144,7 @@ L.DomEvent = {
|
|||||||
|
|
||||||
getMousePosition: function (e, container) {
|
getMousePosition: function (e, container) {
|
||||||
|
|
||||||
var ie7 = L.Browser.ie7,
|
var body = document.body,
|
||||||
body = document.body,
|
|
||||||
docEl = document.documentElement,
|
docEl = document.documentElement,
|
||||||
x = e.pageX ? e.pageX - body.scrollLeft - docEl.scrollLeft: e.clientX,
|
x = e.pageX ? e.pageX - body.scrollLeft - docEl.scrollLeft: e.clientX,
|
||||||
y = e.pageY ? e.pageY - body.scrollTop - docEl.scrollTop: e.clientY,
|
y = e.pageY ? e.pageY - body.scrollTop - docEl.scrollTop: e.clientY,
|
||||||
@ -159,19 +158,6 @@ L.DomEvent = {
|
|||||||
left = rect.left - container.clientLeft,
|
left = rect.left - container.clientLeft,
|
||||||
top = rect.top - container.clientTop;
|
top = rect.top - container.clientTop;
|
||||||
|
|
||||||
// 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 += container.scrollWidth - container.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(container, 'overflow-y') !== 'hidden' &&
|
|
||||||
L.DomUtil.getStyle(container, 'overflow') !== 'hidden') {
|
|
||||||
left += 17;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pos._subtract(new L.Point(left, top));
|
return pos._subtract(new L.Point(left, top));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@ L.DomUtil = {
|
|||||||
el = element,
|
el = element,
|
||||||
docBody = document.body,
|
docBody = document.body,
|
||||||
docEl = document.documentElement,
|
docEl = document.documentElement,
|
||||||
pos,
|
pos;
|
||||||
ie7 = L.Browser.ie7;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
top += el.offsetTop || 0;
|
top += el.offsetTop || 0;
|
||||||
@ -78,33 +77,12 @@ L.DomUtil = {
|
|||||||
top -= el.scrollTop || 0;
|
top -= el.scrollTop || 0;
|
||||||
left -= el.scrollLeft || 0;
|
left -= el.scrollLeft || 0;
|
||||||
|
|
||||||
// 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;
|
el = el.parentNode;
|
||||||
} while (el);
|
} while (el);
|
||||||
|
|
||||||
return new L.Point(left, top);
|
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) {
|
create: function (tagName, className, container) {
|
||||||
|
|
||||||
var el = document.createElement(tagName);
|
var el = document.createElement(tagName);
|
||||||
|
Loading…
Reference in New Issue
Block a user