mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Always access "global" constructors on window object now.
This commit is contained in:
parent
77be5616b6
commit
d33fff31b8
3 changed files with 4 additions and 3 deletions
|
@ -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!');
|
||||
|
|
|
@ -380,7 +380,7 @@ new function() {
|
|||
definitions = null;
|
||||
}
|
||||
return options.asString
|
||||
? new XMLSerializer().serializeToString(svg)
|
||||
? new window.XMLSerializer().serializeToString(svg)
|
||||
: svg;
|
||||
}
|
||||
|
||||
|
|
|
@ -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...
|
||||
|
|
Loading…
Reference in a new issue