diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-02-07 10:32:15 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-02-07 10:32:15 +0100 |
commit | ec0a8aee0e21a93b22c255dae6768a9ff7b09e73 (patch) | |
tree | c20b10404c8a0f58f8ab8e4c309f7192bfc6076c /src | |
parent | 2b12c6a5ff9d5ba875f774ddf15325ffae171a35 (diff) | |
download | svg.js-ec0a8aee0e21a93b22c255dae6768a9ff7b09e73.tar.gz svg.js-ec0a8aee0e21a93b22c255dae6768a9ff7b09e73.zip |
make sure to remove event handlers from temporary image (#805)
Diffstat (limited to 'src')
-rw-r--r-- | src/image.js | 8 |
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) } } |