[js-phantomjs] refactoring