Always access "global" constructors on window object now.

This commit is contained in:
Jürg Lehni 2016-01-26 20:33:19 +01:00
parent 77be5616b6
commit d33fff31b8
3 changed files with 4 additions and 3 deletions

View file

@ -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!');

View file

@ -380,7 +380,7 @@ new function() {
definitions = null;
}
return options.asString
? new XMLSerializer().serializeToString(svg)
? new window.XMLSerializer().serializeToString(svg)
: svg;
}

View file

@ -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...