mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-23 00:34:55 +00:00
Do not propagate click when element has been removed from dom (#9052)
This commit is contained in:
@ -308,6 +308,21 @@ describe('Popup', () => {
|
||||
expect(map.hasLayer(layer._popup)).to.be.true;
|
||||
});
|
||||
|
||||
|
||||
it('can change popup content with a click on removed DOM', () => {
|
||||
const popup = new Popup()
|
||||
.setLatLng(center)
|
||||
.setContent('<p onclick="this.parentNode.innerHTML = \'changed\'">initial</p>')
|
||||
.openOn(map);
|
||||
|
||||
|
||||
UIEventSimulator.fire('click', popup._container.querySelector('p'));
|
||||
|
||||
expect(popup._container.innerHTML).to.not.contain('initial');
|
||||
expect(popup._container.innerHTML).to.contain('changed');
|
||||
expect(map.hasLayer(popup)).to.be.true;
|
||||
});
|
||||
|
||||
describe('autoPan option should pan popup into visibility', () => {
|
||||
// Helper function which calculates the offset of the map-container & popup-container in pixel
|
||||
function getPopupOffset(map, popup) {
|
||||
|
Reference in New Issue
Block a user