PhantomJS rewriting URL in backgroundImage property to local file system -


i using phantomjs rewriting of html. i'm adding background-image property element. when write out resulting dom, url has been rewritten local url. i've boiled down following test case:

js

var page = require('webpage').create(); page.open("test.html",function(){     settimeout(function(){         page.evaluate(function(){             document.getelementbyid("test").style.backgroundimage="url(test.png)";         });         console.log(page.content);         phantom.exit();    },1000); }); 

html

<html>     <body>         <div id="test"></div>     </body> </html> 

output

$ phantomjs test.js <html><head></head><body>     <div id="test" style="background-image: url(file:///c:/cygwin/tmp/test.png); ">     </div>   </body></html> 

update

  1. the problem remains if specify ./test.png or //test.png. however, http://example.com/test.png left unchanged, might expected.

  2. if html document opened in chrome, , background-image property added div element in style inspector, url unmodified, whether document inspected in elements tab in devtools, or via document.body.innerhtml displayed in console, or copying html.

update 2

i found out if document located in chrome, , command elt.style.backgroundimage="url(test.png"); issued in console, url rewritten. @ end of day appears not phantomjs issue, although still don't understand behavior.

obviously, don't want url rewritten in fashion, , don't understand why phantomjs feels need this. ideas?


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)