@@ -466,7 +466,7 @@ new function() {
466466 definitions . svgs [ type + '-' + item . _id ] = node ;
467467 }
468468
469- function exportDefinitions ( node ) {
469+ function exportDefinitions ( node , asString ) {
470470 if ( ! definitions )
471471 return node ;
472472 // We can only use svg nodes as defintion containers. Have the loop
@@ -489,7 +489,7 @@ new function() {
489489 }
490490 // Clear definitions at the end of export
491491 definitions = null ;
492- return svg ;
492+ return asString ? new XMLSerializer ( ) . serializeToString ( svg ) : svg ;
493493 }
494494
495495 function exportSVG ( item ) {
@@ -509,8 +509,8 @@ new function() {
509509 *
510510 * @return {SVGSVGElement } the item converted to an SVG node
511511 */
512- exportSVG : function ( ) {
513- return exportDefinitions ( exportSVG ( this ) ) ;
512+ exportSVG : function ( asString ) {
513+ return exportDefinitions ( exportSVG ( this ) , asString ) ;
514514 }
515515 } ) ;
516516
@@ -523,7 +523,7 @@ new function() {
523523 *
524524 * @return {SVGSVGElement } the project converted to an SVG node
525525 */
526- exportSVG : function ( ) {
526+ exportSVG : function ( asString ) {
527527 var layers = this . layers ,
528528 size = this . view . getSize ( ) ,
529529 node = createElement ( 'svg' , {
@@ -537,7 +537,7 @@ new function() {
537537 } ) ;
538538 for ( var i = 0 , l = layers . length ; i < l ; i ++ )
539539 node . appendChild ( exportSVG ( layers [ i ] ) ) ;
540- return exportDefinitions ( node ) ;
540+ return exportDefinitions ( node , asString ) ;
541541 }
542542 } ) ;
543543} ;
0 commit comments