Skip to content

Commit 7e21ea7

Browse files
committed
add comment about font-family "\' \'"
1 parent b729a59 commit 7e21ea7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/snapshot/tosvg.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,21 @@ module.exports = function toSVG(gd, format) {
113113
// serialized svg because the style attribute itself is double-quoted!
114114
// Is this an IE thing? Any other attributes or style elements that can have quotes in them?
115115
// TODO: this looks like a noop right now - what happened to it?
116+
117+
/*
118+
* Font-family styles with double quotes in them breaks the to-image
119+
* step in FF42 because the style attribute itself is wrapped in
120+
* double quotes. See:
121+
*
122+
* - http://codepen.io/etpinard/pen/bEdQWK
123+
* - https://github.com/plotly/plotly.js/pull/104
124+
*
125+
* for more info.
126+
*/
116127
var ff = txt.style('font-family');
117-
if(ff && ff.indexOf('"') !== -1) txt.style('font-family', ff.replace(/"/g, '\\\''));
128+
if(ff && ff.indexOf('"') !== -1) {
129+
txt.style('font-family', ff.replace(/"/g, '\\\''));
130+
}
118131
});
119132

120133
if(format === 'pdf' || format === 'eps') {

0 commit comments

Comments
 (0)