mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Avoid multiple onLoad calls when remote SVG cannot be loaded.
This commit is contained in:
parent
5bb3482073
commit
20253e58a7
1 changed files with 2 additions and 2 deletions
|
@ -496,7 +496,7 @@ new function() {
|
||||||
if (typeof node === 'string') {
|
if (typeof node === 'string') {
|
||||||
// Check if the string does not represent SVG data, in which case
|
// Check if the string does not represent SVG data, in which case
|
||||||
// it must be a url of a SVG to be loaded.
|
// it must be a url of a SVG to be loaded.
|
||||||
if (isRoot && !/^.*</.test(node)) {
|
if (isRoot && node && !/^.*</.test(node)) {
|
||||||
if (typeof options === 'function')
|
if (typeof options === 'function')
|
||||||
options = { onLoad: options };
|
options = { onLoad: options };
|
||||||
// Remember current scope so we can restore it in the callback.
|
// Remember current scope so we can restore it in the callback.
|
||||||
|
@ -516,7 +516,7 @@ new function() {
|
||||||
// jsdom in Node.js uses uppercase values for nodeName...
|
// jsdom in Node.js uses uppercase values for nodeName...
|
||||||
var type = node.nodeName.toLowerCase(),
|
var type = node.nodeName.toLowerCase(),
|
||||||
importer = importers[type],
|
importer = importers[type],
|
||||||
item = importer && importer(node, type, isRoot, options),
|
item = importer && importer(node, type, isRoot, options) || null,
|
||||||
data = type !== '#document' && node.getAttribute('data-paper-data');
|
data = type !== '#document' && node.getAttribute('data-paper-data');
|
||||||
if (item) {
|
if (item) {
|
||||||
// See importGroup() for an explanation of this filtering:
|
// See importGroup() for an explanation of this filtering:
|
||||||
|
|
Loading…
Reference in a new issue