From d33fff31b89a30679f88e225e57767ecee8c0ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 26 Jan 2016 20:33:19 +0100 Subject: [PATCH] Always access "global" constructors on window object now. --- examples/Node.js/Raster.js | 2 +- src/svg/SVGExport.js | 2 +- src/svg/SVGImport.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/Node.js/Raster.js b/examples/Node.js/Raster.js index 91242d10..381a7605 100644 --- a/examples/Node.js/Raster.js +++ b/examples/Node.js/Raster.js @@ -20,7 +20,7 @@ raster.onLoad = function() { var path = require('path'); var fs = require('fs'); - var svg = new XMLSerializer().serializeToString(project.exportSVG()); + var svg = new paper.XMLSerializer().serializeToString(project.exportSVG()); fs.writeFile(path.resolve(__dirname, 'out.svg'),svg, function (err) { if (err) throw err; console.log('Saved!'); diff --git a/src/svg/SVGExport.js b/src/svg/SVGExport.js index a18bb8c1..674430d2 100644 --- a/src/svg/SVGExport.js +++ b/src/svg/SVGExport.js @@ -380,7 +380,7 @@ new function() { definitions = null; } return options.asString - ? new XMLSerializer().serializeToString(svg) + ? new window.XMLSerializer().serializeToString(svg) : svg; } diff --git a/src/svg/SVGImport.js b/src/svg/SVGImport.js index 9ac7ea38..63fc5b88 100644 --- a/src/svg/SVGImport.js +++ b/src/svg/SVGImport.js @@ -587,7 +587,8 @@ new function() { } if (typeof source === 'string') - node = new DOMParser().parseFromString(source, 'image/svg+xml'); + node = new window.DOMParser().parseFromString(source, + 'image/svg+xml'); if (!node.nodeName) throw new Error('Unsupported SVG source: ' + source); // jsdom in Node.js uses uppercase values for nodeName...