Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
884e1b60
...
884e1b6076178a07c0c1280b63744bd161103dad
authored
2012-04-10 10:52:40 -0700
by
nrabinowitz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixing mouse.processEvent method
1 parent
7bf96e3f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
modules/mouse.js
modules/mouse.js
View file @
884e1b6
...
...
@@ -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
);
...
...
Please
register
or
sign in
to post a comment