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:
Florian Bischof
2022-06-08 10:37:14 +02:00
committed by GitHub
parent f46f908bf0
commit c50688a25f
2 changed files with 17 additions and 1 deletions

View File

@ -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();
});
});
});