summaryrefslogtreecommitdiffstats
path: root/src/event.js
blob: 32c2be28e58f3953a17c2ae3680c18a946f48d46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[ 'click',
  'dblclick',
  'mousedown',
  'mouseup',
  'mouseover',
  'mouseout',
  'mousemove',
  'touchstart',
  'touchend',
  'touchmove',
  'touchcancel' ].forEach(function(e) {
  
  // add event to SVG.Elment
  SVG.Element.prototype[e] = function(f) {
    var s = this;

    // bind event to element rather than element node
    this.node['on' + e] = function() {
      return f.apply(s, arguments);
    };

    // return self
    return this;
  };
});