Removing a control not previously added raises an error #2877
Closed
Description
opened on Aug 27, 2014
I refer to v0.7.3 tag, not to the last commit.
If I add a control on a map using control.addTo(map), I can remove it later using control.removeFrom(map) without problems. But if I try to remove it before any addTo(map) calls, it fails: "Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node" (in Chomium console).
It could be possibile to add a boolean in control definition (in https://github.com/Leaflet/Leaflet/blob/v0.7.3/src/control/Control.js) such as control.isAdded to track the state of the control and to use it in add / remove methods and avoid errors.
Metadata
Assignees
Labels
No labels
Activity