Commit 884e1b60 884e1b6076178a07c0c1280b63744bd161103dad by nrabinowitz

Fixing mouse.processEvent method

1 parent 7bf96e3f
......@@ -38,6 +38,8 @@ var Mouse = function(casper) {
if (!utils.isCasperObject(casper)) {
throw new CasperError('Mouse() needs a Casper instance');
}
var slice = Array.prototype.slice;
var supportedEvents = ['mouseup', 'mousedown', 'click', 'mousemove'];
......@@ -54,7 +56,7 @@ var Mouse = function(casper) {
if (!utils.isString(type) || supportedEvents.indexOf(type) === -1) {
throw new CasperError('Mouse.processEvent(): Unsupported mouse event type: ' + type);
}
args = Array.prototype.slice.call(args); // cast Arguments -> Array
args = slice.call(args); // cast Arguments -> Array
casper.emit('mouse.' + type.replace('mouse', ''), args);
switch (args.length) {
case 0:
......@@ -79,7 +81,9 @@ var Mouse = function(casper) {
}
}
this.processEvent = processEvent;
this.processEvent = function() {
processEvent(arguments[0], slice.call(arguments, 1));
}
this.click = function click() {
processEvent('click', arguments);
......