score:3

Accepted answer

Apparently I hadn't added enough groups. The easy solution was to add another append("g") to the svgGroup I was creating, for a last line looking like this:

var svgGroup = treeContainer.append("g")
                .attr("clip-path","url(#clip)")
                .append("g");

Related Query