Commit 179dd870 179dd8702c4128937a34b3120dbc39b7331321fa by Nicolas Perriault

reordered some method names

1 parent 478dcd23
......@@ -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.
*
......
......@@ -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;
......