99
1010'use strict' ;
1111
12- var Plotly = require ( '../plotly' ) ,
13- d3 = require ( 'd3' ) ;
12+ var Plotly = require ( '../plotly' ) ;
13+ var d3 = require ( 'd3' ) ;
14+
15+ var xmlnsNamespaces = require ( '../constants/xmlns_namespaces' ) ;
16+
1417
1518module . exports = function toSVG ( gd , format ) {
1619
@@ -139,8 +142,8 @@ module.exports = function toSVG(gd, format) {
139142
140143 // fix for IE namespacing quirk?
141144 // http://stackoverflow.com/questions/19610089/unwanted-namespaces-on-svg-markup-when-using-xmlserializer-in-javascript-with-ie
142- svg . node ( ) . setAttributeNS ( 'http://www.w3.org/2000/ xmlns/' , 'xmlns' , 'http://www.w3.org/2000/ svg' ) ;
143- svg . node ( ) . setAttributeNS ( 'http://www.w3.org/2000/ xmlns/' , 'xmlns:xlink' , 'http://www.w3.org/1999/ xlink' ) ;
145+ svg . node ( ) . setAttributeNS ( xmlnsNamespaces . xmlns , 'xmlns' , xmlnsNamespaces . svg ) ;
146+ svg . node ( ) . setAttributeNS ( xmlnsNamespaces . xmlns , 'xmlns:xlink' , xmlnsNamespaces . xlink ) ;
144147
145148 var s = new window . XMLSerializer ( ) . serializeToString ( svg . node ( ) ) ;
146149 s = Plotly . util . html_entity_decode ( s ) ;
@@ -154,8 +157,8 @@ function insertGlImage(fullLayout, scene, opts) {
154157
155158 fullLayout . _glimages . append ( 'svg:image' )
156159 . attr ( {
157- xmlns :'http://www.w3.org/2000/ svg' ,
158- 'xlink:xlink: href' : imageData , // odd d3 quirk, need namespace twice
160+ xmlns : xmlnsNamespaces . svg ,
161+ 'xlink:href' : imageData ,
159162 x : opts . x ,
160163 y : opts . y ,
161164 width : opts . width ,
0 commit comments