Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
moved i and l delarations to the top of page.evaluate()
Browse files Browse the repository at this point in the history
  • Loading branch information
firedfox committed Apr 10, 2012
1 parent bf24d4d commit c373ac4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/webpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ exports.create = function (opts) {
* @return {*} the function call result
*/
page.evaluate = function (func, args) {
var str, arg;
var str, arg, i, l;
if (!(func instanceof Function || typeof func === 'string' || func instanceof String)) {
throw "Wrong use of WebPage#evaluate";
}
str = 'function() { return (' + func.toString() + ')(';
for (var i = 1, l = arguments.length; i < l; i++) {
for (i = 1, l = arguments.length; i < l; i++) {
arg = arguments[i];
if (/object|string/.test(typeof arg) && !(arg instanceof RegExp)) {
str += 'JSON.parse(' + JSON.stringify(JSON.stringify(arg)) + '),';
Expand Down

0 comments on commit c373ac4

Please sign in to comment.