Skip to content

Commit

Permalink
Fix bug system.args cannot be changed
Browse files Browse the repository at this point in the history
The system.args cannot be modified through splice.
Fetching arguments through an array slice.
  • Loading branch information
Daniele committed Apr 7, 2016
1 parent 24e3241 commit f241209
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions render.js
Expand Up @@ -4,8 +4,8 @@ var system = require('system');
// ADDRESS CHANGE IN PARAMETERS HANDLING FOR PHANTOMJS 2.x
var phantomargs;
if(phantom.version.major >= 2) {
system.args.splice(0,1); // remove the script name from the arguments
phantomargs = system.args;
// remove the script name from the arguments
phantomargs = system.args.slice(1,system.args.length);
} else {
phantomargs = phantom.args;
}
Expand All @@ -16,7 +16,7 @@ var contentsCb = function(pobj) {
pobj.contents = phantom.callback(function(currentPage, pages) {
return contentStr.replace(/\{currentPage\}/g, currentPage).replace(/\{pages\}/g, pages);
});
}
};

if (phantomargs.length < 2) {
console.log('11');
Expand Down

0 comments on commit f241209

Please sign in to comment.