summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2012-12-30 13:20:59 +0100
committerwout <wout@impinc.co.uk>2012-12-30 13:20:59 +0100
commitf6724c34bfdd5d3e207b4fc395d988de617b2b94 (patch)
tree5f566d4c271a4f2323031b89f03dea769bda9925 /src
parent44be0ceecb2ba43ab45d7fefa299179ae76303fa (diff)
downloadsvg.js-f6724c34bfdd5d3e207b4fc395d988de617b2b94.tar.gz
svg.js-f6724c34bfdd5d3e207b4fc395d988de617b2b94.zip
Added event.js
Diffstat (limited to 'src')
-rw-r--r--src/event.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/event.js b/src/event.js
new file mode 100644
index 0000000..6a9c3e3
--- /dev/null
+++ b/src/event.js
@@ -0,0 +1,15 @@
+
+var eventTypes = ['click', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove'];
+
+// generate events
+for (var i = eventTypes.length - 1; i >= 0; i--) {
+ var t = eventTypes[i];
+ SVG.Element.prototype[t] = function(f) {
+ var e = this;
+ this.node['on' + t] = function() {
+ return f.apply(e, arguments);
+ };
+
+ return e;
+ };
+}; \ No newline at end of file