Skip to content

Commit 0007807

Browse files
committed
merge top-paper <defs> into main svg on to-svg step
1 parent 59b0c52 commit 0007807

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/snapshot/tosvg.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,21 @@ module.exports = function toSVG(gd, format) {
8989
// assumes everything in toppaper is a group, and if it's empty (like hoverlayer)
9090
// we can ignore it
9191
if(fullLayout._toppaper) {
92-
var topGroups = fullLayout._toppaper.node().childNodes,
93-
topGroup;
92+
var topDefs = fullLayout._topdefs.node().childNodes;
93+
94+
for(i = 0; i < topDefs.length; i++) {
95+
var topDef = topDefs[i];
96+
97+
fullLayout._defs.node().appendChild(topDef);
98+
}
99+
100+
fullLayout._topdefs.remove();
101+
102+
var topGroups = fullLayout._toppaper.node().childNodes;
103+
94104
for(i = 0; i < topGroups.length; i++) {
95-
topGroup = topGroups[i];
105+
var topGroup = topGroups[i];
106+
96107
if(topGroup.childNodes.length) svg.node().appendChild(topGroup);
97108
}
98109
}

0 commit comments

Comments
 (0)