mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-20 14:34:38 +00:00
Fix: _isClickDisabled
throws error if parent is removed from DOM (#8288)
* disableClickPropagation: does not break if element is not in the DOM * Update spec/suites/map/MapSpec.js
This commit is contained in:
@ -1367,4 +1367,20 @@ describe("Map", function () {
|
||||
}).to.not.throwException();
|
||||
});
|
||||
});
|
||||
|
||||
describe('#disableClickPropagation', function () {
|
||||
it('does not break if element is not in the DOM anymore', function () {
|
||||
map.setView([0, 0], 0);
|
||||
var parent = document.createElement('div');
|
||||
var child = document.createElement('div');
|
||||
parent.appendChild(child);
|
||||
container.appendChild(parent);
|
||||
L.DomEvent.on(child, 'click', function () {
|
||||
L.DomUtil.remove(parent);
|
||||
});
|
||||
expect(function () {
|
||||
happen.once(child, {type: 'click'});
|
||||
}).to.not.throwException();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user