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
179dd870
...
179dd8702c4128937a34b3120dbc39b7331321fa
authored
2012-03-25 19:25:04 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
reordered some method names
1 parent
478dcd23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
29 deletions
modules/casper.js
modules/clientutils.js
modules/casper.js
View file @
179dd87
...
...
@@ -445,20 +445,6 @@ Casper.prototype.exists = function exists(selector) {
};
/**
* Checks if an element matching the provided CSS3 selector is visible
* current page DOM by checking that offsetWidth and offsetHeight are
* both non-zero.
*
* @param String selector A CSS3 selector
* @return Boolean
*/
Casper
.
prototype
.
visible
=
function
visible
(
selector
)
{
return
this
.
evaluate
(
function
(
selector
)
{
return
__utils__
.
visible
(
selector
);
},
{
selector
:
selector
});
};
/**
* Exits phantom.
*
* @param Number status Status
...
...
@@ -1042,6 +1028,20 @@ Casper.prototype.viewport = function viewport(width, height) {
};
/**
* Checks if an element matching the provided CSS3 selector is visible
* current page DOM by checking that offsetWidth and offsetHeight are
* both non-zero.
*
* @param String selector A CSS3 selector
* @return Boolean
*/
Casper
.
prototype
.
visible
=
function
visible
(
selector
)
{
return
this
.
evaluate
(
function
(
selector
)
{
return
__utils__
.
visible
(
selector
);
},
{
selector
:
selector
});
};
/**
* Adds a new step that will wait for a given amount of time (expressed
* in milliseconds) before processing an optional next one.
*
...
...
modules/clientutils.js
View file @
179dd87
...
...
@@ -163,21 +163,6 @@
};
/**
* Checks if a given DOM element is visible in remote page.
*
* @param String selector CSS3 selector
* @return Boolean
*/
this
.
visible
=
function
(
selector
)
{
try
{
var
el
=
document
.
querySelector
(
selector
);
return
el
&&
el
.
style
.
visibility
!==
'hidden'
&&
el
.
offsetHeight
>
0
&&
el
.
offsetWidth
>
0
;
}
catch
(
e
)
{
return
false
;
}
};
/**
* Fetches innerText within the element(s) matching a given CSS3
* selector.
*
...
...
@@ -458,6 +443,21 @@
}
return
out
;
};
/**
* Checks if a given DOM element is visible in remote page.
*
* @param String selector CSS3 selector
* @return Boolean
*/
this
.
visible
=
function
(
selector
)
{
try
{
var
el
=
document
.
querySelector
(
selector
);
return
el
&&
el
.
style
.
visibility
!==
'hidden'
&&
el
.
offsetHeight
>
0
&&
el
.
offsetWidth
>
0
;
}
catch
(
e
)
{
return
false
;
}
};
};
exports
.
ClientUtils
=
ClientUtils
;
...
...
Please
register
or
sign in
to post a comment