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
ccf9afaa
...
ccf9afaad969a6aa9b039f278df66a4d367e89e9
authored
2012-06-09 07:56:10 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
better handling of clientscripts injection
1 parent
1cf3d9bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
modules/casper.js
modules/casper.js
View file @
ccf9afa
...
...
@@ -1407,17 +1407,19 @@ function createPage(casper) {
}
}
if
(
casper
.
options
.
clientScripts
)
{
if
(
utils
.
isString
(
casper
.
options
.
clientScripts
))
{
casper
.
options
.
clientScripts
=
[
casper
.
options
.
clientScripts
];
}
if
(
!
utils
.
isArray
(
casper
.
options
.
clientScripts
))
{
throw
new
CasperError
(
"The clientScripts option must be an array"
);
}
else
{
casper
.
options
.
clientScripts
.
forEach
(
function
_forEach
(
script
)
{
if
(
casper
.
page
.
injectJs
(
script
))
{
casper
.
log
(
f
(
'Automatically injected %s client side'
,
script
),
"debug"
);
}
else
{
casper
.
log
(
f
(
'Failed injecting %s client side'
,
script
),
"warning"
);
}
});
}
casper
.
options
.
clientScripts
.
forEach
(
function
_forEach
(
script
)
{
if
(
casper
.
page
.
injectJs
(
script
))
{
casper
.
log
(
f
(
'Automatically injected %s client side'
,
script
),
"debug"
);
}
else
{
casper
.
warn
(
'Failed injecting %s client side'
,
script
);
}
});
}
// Client-side utils injection
casper
.
injectClientUtils
();
...
...
Please
register
or
sign in
to post a comment