summaryrefslogtreecommitdiffstats
path: root/src/image.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/image.js')
-rw-r--r--src/image.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/image.js b/src/image.js
index 84063de..6f8ba5b 100644
--- a/src/image.js
+++ b/src/image.js
@@ -14,8 +14,7 @@ SVG.Image = SVG.invent({
var img = new window.Image()
SVG.on(img, 'load', function(e) {
-
- var p = this.parent()
+ var p = this.parent(SVG.Pattern)
// ensure image size
if (this.width() == 0 && this.height() == 0)
@@ -37,6 +36,11 @@ SVG.Image = SVG.invent({
}
}, this)
+ SVG.on(img, 'load error', function() {
+ // dont forget to unbind memory leaking events
+ SVG.off(img)
+ })
+
return this.attr('href', (img.src = url), SVG.xlink)
}
}