Avoid multiple onLoad calls when remote SVG cannot be loaded.

This commit is contained in:
Jürg Lehni 2013-11-03 00:00:46 +01:00
parent 5bb3482073
commit 20253e58a7

View file

@ -496,7 +496,7 @@ new function() {
if (typeof node === 'string') {
// Check if the string does not represent SVG data, in which case
// it must be a url of a SVG to be loaded.
if (isRoot && !/^.*</.test(node)) {
if (isRoot && node && !/^.*</.test(node)) {
if (typeof options === 'function')
options = { onLoad: options };
// 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...
var type = node.nodeName.toLowerCase(),
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');
if (item) {
// See importGroup() for an explanation of this filtering: