Leaflet.markercluster onclick error - Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

davidtgq

I am trying to call a function on click to .append some text outside the map canvas. This example from the docs seems to have what I'm looking for, but I haven't been able to successfully apply it to my project.

The code I've tried:

var tiles = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    maxZoom: 18,
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
  }),
  latlng = L.latLng(60, -100);

var map = L.map('map', {center: latlng, zoom: 4, layers: [tiles]});
var progress = document.getElementById('progress');
var progressBar = document.getElementById('progress-bar');

function updateProgressBar(processed, total, elapsed, layersArray) {
  if (elapsed > 1000) {
    progress.style.display = 'block';
    progressBar.style.width = Math.round(processed/total*100) + '%';
  }

  if (processed === total) {
    progress.style.display = 'none';
  }
}

var markers = L.markerClusterGroup({ chunkedLoading: true, chunkProgress: updateProgressBar });
var markerList = [];

function populate() {
  getCoordinates(function (data) {
    for (var i in data) {
      var a = data[i];
      var title = a.id;
      var marker = L.marker(L.latLng(a.lat, a.lng), {title: title});
      marker.bindPopup(title);
      markers.addLayer(marker);
      markerList.push(marker);
    }

    map.addLayer(markers);
  });
}

This is the error from the console of Chrome when clicking on a marker, using leaflet 1.0 beta:

Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
  L.Popup.L.Layer.extend._updateContent @ leaflet-src.js:4462
  L.Popup.L.Layer.extend.update @ leaflet-src.js:4373
  L.Popup.L.Layer.extend.onAdd @ leaflet-src.js:4308
  L.Layer.L.Evented.extend._layerAdd @ leaflet-src.js:2534
  L.Map.L.Evented.extend.whenReady @ leaflet-src.js:2382
  L.Map.include.addLayer @ leaflet-src.js:2558
  L.Map.include.openPopup @ leaflet-src.js:4592
  L.Layer.include.openPopup @ leaflet-src.js:4684
  L.Layer.include._openPopup @ leaflet-src.js:4746
  L.Evented.L.Class.extend.fire @ leaflet-src.js:488
  L.Map.L.Evented.extend._fireDOMEvent @ leaflet-src.js:2363
  L.Map.L.Evented.extend._handleDOMEvent @ leaflet-src.js:2331handler @ leaflet-src.js:6945
iH8

The error is generated by the popup, has nothing to do with your click event/handler. When clicking a marker, it's popup tries to set it's content to the title variable which isn't defined.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Getting an error: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

From Dev

Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

From Dev

Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'. in Chrome

From Dev

Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node' error on append tr to a table

From Dev

failed to execute appendchild on node

From Dev

Uncaught TypeError: Failed to execute 'insertBefore' on 'Node': parameter 1 is not of type 'Node'

From Dev

typeError: Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node Polymer

From Dev

Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'

From Dev

Javascript error: Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'

From Dev

Failed to execute 'appendChild' on 'Node': The new child element is null

From Dev

jQuery Chosen: Uncaught NotFoundError: Failed to execute 'appendChild' on 'Node':

From Dev

Error: Failed to execute 'insertBefore' on 'Node'

From Dev

DataTables error 'Failed to execute appendChild()'

From Dev

Cannot append DOM element to DIV node: Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node'

From Dev

XPath Error in Mink: Failed to execute 'evaluate' on 'Document': The result is not a node set, and therefore cannot be converted to the desired type

From Dev

Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'

From Dev

TypeError: Argument 1 of Node.appendChild does not implement interface Node

From Dev

Argument 1 of Node.appendChild does not implement interface Node

From Dev

NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node

From Dev

Failing Angular directive unit test on MutationObserver: parameter 1 is not of type 'Node'

From Dev

Node Child Process Exec Command Failed with error code 1

From Dev

OpenShift: "Failed to execute control start" on node application

From Dev

Error importing Leaflet and Leaflet-Providers when run in node

From Dev

Error: Failed to execut 'removeChild' on 'Node'

From Dev

Angularjs : Uncaught TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'

From Dev

polymer.html: Uncaught TypeError: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'

From Dev

Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element' - Angular / Ionic kendo-chart

From Dev

Open leaflet marker using url parameter not working now that markercluster is used

From Dev

Uncaught NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node

Related Related

  1. 1

    Getting an error: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

  2. 2

    Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

  3. 3

    Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'. in Chrome

  4. 4

    Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node' error on append tr to a table

  5. 5

    failed to execute appendchild on node

  6. 6

    Uncaught TypeError: Failed to execute 'insertBefore' on 'Node': parameter 1 is not of type 'Node'

  7. 7

    typeError: Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node Polymer

  8. 8

    Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'

  9. 9

    Javascript error: Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'

  10. 10

    Failed to execute 'appendChild' on 'Node': The new child element is null

  11. 11

    jQuery Chosen: Uncaught NotFoundError: Failed to execute 'appendChild' on 'Node':

  12. 12

    Error: Failed to execute 'insertBefore' on 'Node'

  13. 13

    DataTables error 'Failed to execute appendChild()'

  14. 14

    Cannot append DOM element to DIV node: Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node'

  15. 15

    XPath Error in Mink: Failed to execute 'evaluate' on 'Document': The result is not a node set, and therefore cannot be converted to the desired type

  16. 16

    Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'

  17. 17

    TypeError: Argument 1 of Node.appendChild does not implement interface Node

  18. 18

    Argument 1 of Node.appendChild does not implement interface Node

  19. 19

    NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node

  20. 20

    Failing Angular directive unit test on MutationObserver: parameter 1 is not of type 'Node'

  21. 21

    Node Child Process Exec Command Failed with error code 1

  22. 22

    OpenShift: "Failed to execute control start" on node application

  23. 23

    Error importing Leaflet and Leaflet-Providers when run in node

  24. 24

    Error: Failed to execut 'removeChild' on 'Node'

  25. 25

    Angularjs : Uncaught TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'

  26. 26

    polymer.html: Uncaught TypeError: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'

  27. 27

    Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element' - Angular / Ionic kendo-chart

  28. 28

    Open leaflet marker using url parameter not working now that markercluster is used

  29. 29

    Uncaught NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node

HotTag

Archive