Skip to content

Commit 860e647

Browse files
committed
make copy of top-paper childNodes array-like:
- as childNodes prop gets mutated in top-group loop
1 parent 196d7dc commit 860e647

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/snapshot/tosvg.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ module.exports = function toSVG(gd, format) {
8585
.appendChild(geoFramework.node());
8686
}
8787

88-
// now that we've got the 3d images in the right layer, add top items above them
89-
// assumes everything in toppaper is a group, and if it's empty (like hoverlayer)
90-
// we can ignore it
88+
// now that we've got the 3d images in the right layer,
89+
// add top items above them assumes everything in toppaper is either
90+
// a group or a defs, and if it's empty (like hoverlayer) we can ignore it.
9191
if(fullLayout._toppaper) {
92+
var nodes = fullLayout._toppaper.node().childNodes;
9293

93-
94-
var topGroups = fullLayout._toppaper.node().childNodes;
94+
// make copy of nodes as childNodes prop gets mutated in loop below
95+
var topGroups = Array.prototype.slice.call(nodes);
9596

9697
for(i = 0; i < topGroups.length; i++) {
9798
var topGroup = topGroups[i];

0 commit comments

Comments
 (0)