Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!