mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-12-08 21:26:14 +00:00
Do not propagate click when element has been removed from dom (#9052)
This commit is contained in:
parent
847fbb4d62
commit
b2048d2d8f
@ -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) {
|
||||
|
||||
@ -1389,7 +1389,7 @@ export const Map = Evented.extend({
|
||||
|
||||
_isClickDisabled(el) {
|
||||
while (el && el !== this._container) {
|
||||
if (el['_leaflet_disable_click']) { return true; }
|
||||
if (el['_leaflet_disable_click'] || !el.parentNode) { return true; }
|
||||
el = el.parentNode;
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user