Leaflet.utfgrid icon indicating copy to clipboard operation
Leaflet.utfgrid copied to clipboard

Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node'

Open vjpr opened this issue 10 years ago • 5 comments

I receive this error ocassionally.

Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
  window.(anonymous function).(anonymous function) @ leaflet.utfgrid.js:257
  (anonymous function) @ tile.json?callback=lu0.lu_3_7_1:1

This is the code:

        window[wk][functionName] = function (data) {
            self._cache[key] = data;
            delete window[wk][functionName];
            head.removeChild(script); // <--
            self._finish_request(key);
        };

vjpr avatar Sep 20 '15 18:09 vjpr

Are you getting timeouts loading tiles? Not sure how this happens, but maybe if loading is aborted and then it finishes loading?

danzel avatar Sep 22 '15 02:09 danzel

I'm getting this same issue. Doing some research leads me to believe it may have something to do with Angular.

syork avatar Mar 11 '16 05:03 syork

I'm getting this issue too without Angular.

I think that head.removeChild(script) is sometimes executed twice. On second call, script is not in the head anymore and an error is thrown :

window[wk][functionName] = function (data) {
        self._cache[key] = data;
        delete window[wk][functionName];
        head.removeChild(script);
        self._finish_request(key);
    };
    this._queue_request(key, url, function () {
        head.appendChild(script);
        return {
            abort: function () {
                head.removeChild(script); // THIS LINE is executed BEFORE the other removeChild that is executed too. The issue is then ONLY showing when abort is requested.
            }
        };
    });

I'm not sure exactly WHEN ABORT is needed (when timeout occures then tiles were not completly loaded I think), but I'm getting this error when I zoomIn and immediately zoomOut. Not leaving enough time to load tiles correctly (but server serves 200 response code - no timeout problem).

It would probably worth testing if childNode exist before attempting deletion to avoid this error.

remilev avatar Aug 31 '16 11:08 remilev

We're also getting this error from the Windshaft example viewer: https://github.com/CartoDB/Windshaft/tree/master/examples/viewer

strk avatar Feb 04 '17 12:02 strk

This fixed the problem for me Change

head.removeChild(script);

for

if (script.parentElement==head) {
  head.removeChild(script);
}

SergioGutTal avatar Jul 06 '17 20:07 SergioGutTal