Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

209
Vistas
d3 - SVG's documentElement turns null after appending to HTML element

In my project, I have an HTML slider that selects a year and has an EventListener such that when the slider is changed, an SVG corresponding to the selected year is added to a container div.

Here's the function called by the EventListener:

function loadMap(e) {
    var year = e.target.value;
    container.html(""); //clear previous svg
    container.node().append(svgs[year - 1956].documentElement);
}

svgs is an array of documents loaded from d3.xml(), and container holds the div as returned by a d3.select() for the div's id.

The function loads the content without problem the first time a year is selected. But if I return to that year a second time, svgs[year - 1956].documentElement is null. I've tried appending a documentElement.cloneNode() instead, and while that fixes the null issue, the SVG graphics aren't showing up. Any suggestions?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda