Paste: phantomjs question

Author: erg
Mode: javascript
Date: Fri, 13 Dec 2013 23:37:59
Plain Text |
// #plaintext starts as "asdf" and returns as "asdfhi"
// out2.png doesn't have the "hi" appended to it

var page = require('webpage').create();
page.open('http://localhost:3000', function() {

  console.log('Downloaded');

  page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() {
    console.log("RENDERING #1");
    page.render('./out1.png');
    console.log("about to evaluate()");
    var ret = page.evaluate(function() {
      console.log("APPENDING");
      $("#plaintext").append("hi");
      return $("#plaintext").text();
    });

    console.log("ret", ret);
    function finalize(page) {
      console.log("RENDERING #2");
      page.render('./out2.png');
      console.log("EXITING");
      phantom.exit()
    }
    finalize(page);
  });
});

Annotation: terminal output

Author: erg
Mode: javascript
Date: Fri, 13 Dec 2013 23:38:38
Plain Text |
erg$ phantomjs cptn.js 
2013-12-13 15:35:34.152 phantomjs[38033:507] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead. 
2013-12-13 15:35:34.386 phantomjs[38033:507] CoreText performance note: Client called CTFontCreateWithName() using name "Times New Roman" and got font with PostScript name "TimesNewRomanPSMT". For best performance, only use PostScript names when calling this API.
2013-12-13 15:35:34.386 phantomjs[38033:507] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.
Downloaded
RENDERING #1
about to EVALUATE
ret asdfhi
RENDERING #2
EXITING

New Annotation

Summary:
Author:
Mode:
Body: