Adding phantomjs compatibility.

Works transparently with node.js and phantomjs.