summaryrefslogtreecommitdiffstats
path: root/src/event.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-09-03 12:15:16 +0200
committerwout <wout@impinc.co.uk>2014-09-03 12:15:16 +0200
commit69da2d385450daa158d75ebe59449cc044ec8022 (patch)
tree94d13794806978d4a8ca4d50ac0323b7d93475b7 /src/event.js
parent826649995f1aae806fb9bf8464a4259c4290c4fb (diff)
downloadsvg.js-69da2d385450daa158d75ebe59449cc044ec8022.tar.gz
svg.js-69da2d385450daa158d75ebe59449cc044ec8022.zip
Firefox fixes and event specs
Diffstat (limited to 'src/event.js')
-rwxr-xr-xsrc/event.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/event.js b/src/event.js
index 6108155..3f7e656 100755
--- a/src/event.js
+++ b/src/event.js
@@ -39,15 +39,26 @@ SVG.registerEvent = function(event) {
// Add event binder in the SVG namespace
SVG.on = function(node, event, listener) {
+ // create listener
var l = listener.bind(node.instance || node)
- SVG.listeners[listener] = l
+
+ // ensure node reference
+ SVG.listeners[node] = SVG.listeners[node] || {}
+
+ // reference listener
+ SVG.listeners[node][listener] = l
+
+ // add listener
node.addEventListener(event, l, false)
}
// Add event unbinder in the SVG namespace
SVG.off = function(node, event, listener) {
- node.removeEventListener(event, SVG.listeners[listener], false)
- delete SVG.listeners[listener]
+ // remove listener
+ node.removeEventListener(event, SVG.listeners[node][listener], false)
+
+ // remove listener reference
+ delete SVG.listeners[node][listener]
}
//