fix text selection regression, #1193, #892

This commit is contained in:
Vladimir Agafonkin 2012-12-11 11:44:06 +02:00
parent c05e15f956
commit f203c244d4

View File

@ -35,7 +35,7 @@ L.DomUtil = {
do { do {
top += el.offsetTop || 0; top += el.offsetTop || 0;
left += el.offsetLeft || 0; left += el.offsetLeft || 0;
//add borders //add borders
top += parseInt(L.DomUtil.getStyle(el, "borderTopWidth"), 10) || 0; top += parseInt(L.DomUtil.getStyle(el, "borderTopWidth"), 10) || 0;
left += parseInt(L.DomUtil.getStyle(el, "borderLeftWidth"), 10) || 0; left += parseInt(L.DomUtil.getStyle(el, "borderLeftWidth"), 10) || 0;
@ -105,13 +105,13 @@ L.DomUtil = {
document.selection.empty(); document.selection.empty();
} }
if (!this._onselectstart) { if (!this._onselectstart) {
this._onselectstart = document.onselectstart; this._onselectstart = document.onselectstart || null;
document.onselectstart = L.Util.falseFn; document.onselectstart = L.Util.falseFn;
} }
}, },
enableTextSelection: function () { enableTextSelection: function () {
if (document.onselectstart === L.Util.falseFn && this._onselectstart) { if (document.onselectstart === L.Util.falseFn) {
document.onselectstart = this._onselectstart; document.onselectstart = this._onselectstart;
this._onselectstart = null; this._onselectstart = null;
} }