mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
jsdom uses uppercase values for nodeName with SVG too.
This commit is contained in:
parent
8dbe1f4927
commit
041f3a6c4d
2 changed files with 5 additions and 3 deletions
|
@ -462,10 +462,11 @@ new function() {
|
||||||
function exportDefinitions(node) {
|
function exportDefinitions(node) {
|
||||||
if (!definitions)
|
if (!definitions)
|
||||||
return node;
|
return node;
|
||||||
// We can only use node nodes as defintion containers. Have the loop
|
// We can only use svg nodes as defintion containers. Have the loop
|
||||||
// produce one if it's a single item of another type (when calling
|
// produce one if it's a single item of another type (when calling
|
||||||
// #exportSVG() on an item rather than a whole project)
|
// #exportSVG() on an item rather than a whole project)
|
||||||
var container = node.nodeName == 'svg' && node,
|
// jsdom in Node.js uses uppercase values for nodeName...
|
||||||
|
var container = node.nodeName.toLowerCase() === 'svg' && node,
|
||||||
firstChild = container ? container.firstChild : node;
|
firstChild = container ? container.firstChild : node;
|
||||||
for (var i in definitions.svgs) {
|
for (var i in definitions.svgs) {
|
||||||
if (!container) {
|
if (!container) {
|
||||||
|
|
|
@ -449,7 +449,8 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function importSVG(node, clearDefs) {
|
function importSVG(node, clearDefs) {
|
||||||
var type = node.nodeName,
|
// jsdom in Node.js uses uppercase values for nodeName...
|
||||||
|
var type = node.nodeName.toLowerCase(),
|
||||||
importer = importers[type],
|
importer = importers[type],
|
||||||
item = importer && importer(node, type),
|
item = importer && importer(node, type),
|
||||||
data = node.getAttribute('data-paper-data');
|
data = node.getAttribute('data-paper-data');
|
||||||
|
|
Loading…
Reference in a new issue