summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/image.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/image.js b/src/image.js
index a0adf31..57bb387 100644
--- a/src/image.js
+++ b/src/image.js
@@ -38,6 +38,12 @@ SVG.Image = SVG.invent({
})
}
+ img.onerror = function(e){
+ if (typeof self._error === 'function'){
+ self._error.call(self, e)
+ }
+ }
+
return this.attr('href', (img.src = this.src = url), SVG.xlink)
}
// Add loaded callback
@@ -45,6 +51,11 @@ SVG.Image = SVG.invent({
this._loaded = loaded
return this
}
+
+ , error: function(error) {
+ this._error = error
+ return this
+ }
}
// Add parent method