aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2016-07-12 16:27:28 +0200
committerGitHub <noreply@github.com>2016-07-12 16:27:28 +0200
commit90f8ac60071148d41c209fd0114df1dc1f40e8d8 (patch)
tree04262b319321e7eb24250b515d545b74e97fce7c
parent399dd4a2b4a381a3652695a3ab31f7da72100110 (diff)
parent774e4da62f9850a9609c234ae0e99fc165107a79 (diff)
downloadsvg.js-90f8ac60071148d41c209fd0114df1dc1f40e8d8.tar.gz
svg.js-90f8ac60071148d41c209fd0114df1dc1f40e8d8.zip
Merge pull request #508 from Alexandre-Peyron/master
add error callback on image loading
-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