-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug when removing polyline with empty text from map #18
Comments
Thank you very much for this very detailed feedback ! If you found a fix, yes, open a pull-request with the fix (if you're sure about it, you can even edit the file on the github web page directly, can't be easier) Thanks again ! |
As I described in the issue: makinacorpus#18, this is a very small fix for a very specific scenario. More details in the issue.
So I downloaded a fresh copy because this just started happeing out of now where fellas.
Any ideas on what the hell could make simple code like this stop working after, like more than a year due to this particular instance? Useing Lealet 1.7.0 and it did stop working after I switched the renderer to L.canvas() but I switched it back... still a big problem... You see this allows me to display fiber counts along a build pathway for my data collection web app. |
Additionally this happens with text now... I'm very confused. Someone throw me a bone. I haven't messed with source nor have I changed this functionality. EVERYTHING works but deleting? |
@submarcos is there a chance that someone at makinacorpus would give a look to the leaflet plugins issues and pull-requests? |
Found a little bug. To reproduce:
var map = new L.map(...);
var layer = L.polyLine(...).addTo(map);
layer.on('mouseover', function () {
this.setText(' ► ', {repeat: true, attributes: {fill: 'red'}});
});
layer.on('mouseout', function () {
this.setText(null);
});
map.removeLayer(layer);
At this point the javascript will crash with (in Chrome):
Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
There's a jsfiddle that shows this issue. (shamelessly based this fiddle from a fiddle from another issue)
http://jsfiddle.net/vhpgomes/cmhbQ/19/
The error occurs because the textNode is removed when setting the text to null, but the plugin tries to remove it again when removing the polyline. I fixed it simply by deleting the text when it's first removed (the code already checks for it in the second removal):
delete this._textNode;
I'm new to this github stuff... what should I do? A pull request? Just for this one single line?
The text was updated successfully, but these errors were encountered: