aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-02-20 19:10:03 +0100
committerwout <wout@impinc.co.uk>2013-02-20 19:10:03 +0100
commitae878fd63077d4c95f2de9053a6f0951b55239eb (patch)
tree5dba7bd42a8b5702faeb6cc12d2b4d4099841e51 /src/event.js
parent5020240e4029a61a9620f21d7be4d9764e7723d1 (diff)
downloadsvg.js-ae878fd63077d4c95f2de9053a6f0951b55239eb.tar.gz
svg.js-ae878fd63077d4c95f2de9053a6f0951b55239eb.zip
Created separate classes for SVG.ViewBox anSVG.BBox0.6
Diffstat (limited to 'src/event.js')
-rw-r--r--src/event.js36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/event.js b/src/event.js
index a2bb3f0..df3cd6a 100644
--- a/src/event.js
+++ b/src/event.js
@@ -1,9 +1,9 @@
// ### Manage events on elements
// rect.click(function() {
-// this.fill({ color: '#f06' });
-// });
-[ 'click',
+// this.fill({ color: '#f06' })
+// })
+;[ 'click',
'dblclick',
'mousedown',
'mouseup',
@@ -19,46 +19,46 @@
/* add event to SVG.Element */
SVG.Element.prototype[event] = function(f) {
- var self = this;
+ var self = this
/* bind event to element rather than element node */
this.node['on' + event] = typeof f == 'function'
? function() { return f.apply(self, arguments); }
- : null;
+ : null
- return this;
- };
+ return this
+ }
-});
+})
// Add event binder in the SVG namespace
SVG.on = function(node, event, listener) {
if (node.addEventListener)
- node.addEventListener(event, listener, false);
+ node.addEventListener(event, listener, false)
else
- node.attachEvent('on' + event, listener);
-};
+ node.attachEvent('on' + event, listener)
+}
// Add event unbinder in the SVG namespace
SVG.off = function(node, event, listener) {
if (node.removeEventListener)
- node.removeEventListener(event, listener, false);
+ node.removeEventListener(event, listener, false)
else
- node.detachEvent('on' + event, listener);
-};
+ node.detachEvent('on' + event, listener)
+}
//
SVG.extend(SVG.Element, {
// Bind given event to listener
on: function(event, listener) {
- SVG.on(this.node, event, listener);
+ SVG.on(this.node, event, listener)
- return this;
+ return this
},
// Unbind event from listener
off: function(event, listener) {
- SVG.off(this.node, event, listener);
+ SVG.off(this.node, event, listener)
- return this;
+ return this
}
}); \ No newline at end of file