fix fakeStop in IE<9, close #1850 hopefully

This commit is contained in:
Vladimir Agafonkin 2013-07-12 12:41:04 +03:00
parent fc9d4077cf
commit 5c1a34979e
2 changed files with 14 additions and 8 deletions

View File

@ -171,10 +171,18 @@ L.DomEvent = {
return delta;
},
_fakeStop: function stop(e) {
// fakes stopPropagation by setting a special event flag checked in Map mouse events handler
// jshint camelcase: false
e._leaflet_stop = true;
_skipEvents: {},
_fakeStop: function (e) {
// fakes stopPropagation by setting a special event flag, checked/reset with L.DomEvent._skipped(e)
L.DomEvent._skipEvents[e.type] = true;
},
_skipped: function (e) {
var skipped = this._skipEvents[e.type];
// reset when checking, as it's only used in map container and propagates outside of the map
this._skipEvents[e.type] = false;
return skipped;
},
// check if element really left/entered the event target (for mouseenter/mouseleave)

View File

@ -676,16 +676,14 @@ L.Map = L.Class.extend({
},
_onMouseClick: function (e) {
// jshint camelcase: false
if (!this._loaded || (!e._simulated && this.dragging && this.dragging.moved()) || e._leaflet_stop) { return; }
if (!this._loaded || (!e._simulated && this.dragging && this.dragging.moved()) || L.DomEvent._skipped(e)) { return; }
this.fire('preclick');
this._fireMouseEvent(e);
},
_fireMouseEvent: function (e) {
// jshint camelcase: false
if (!this._loaded || e._leaflet_stop) { return; }
if (!this._loaded || L.DomEvent._skipped(e)) { return; }
var type = e.type;