<commit_before>var sys = require("sys"), fs = require("fs"); 

var dom = require("../../lib/jsdom/level1/core").dom.level1.core;
var window = require("../../lib/jsdom/browser").windowAugmentation(dom).window;
var document = window.document;
var location = window.location;
var navigator = window.navigator;

fs.readFile(__dirname + "/jquery.js", function(err, data) {

  try {
    eval(data.toString());
  } catch (e) {
    sys.puts(sys.inspect(e.stack, true));
  }

  // Doing this requires you setup a parser, easiest way is to put node-htmlparser.js into 
  // ~/.node_libraries/

  window.jQuery(document.body).append("<div class='testing'>Hello World, It works!</div>");
  sys.puts(window.jQuery(".testing").text());
});<commit_msg>Use Script instead of eval for jQuery example<commit_after>var sys = require("sys"), fs = require("fs");

var dom = require("../../lib/jsdom/level1/core").dom.level1.core;
var window = require("../../lib/jsdom/browser").windowAugmentation(dom).window;
var Script = process.binding('evals').Script;

fs.readFile(__dirname + "/jquery.js", function(err, data) {
  
  try {
    Script.runInNewContext(data.toString(), {window: window, location: window.location, navigator: window.navigator});
  } catch(e){
    sys.puts(sys.inspect(e));
  }
  window.jQuery('body').append("<div class='testing'>Hello World, It works!</div>");
  sys.puts(window.jQuery(".testing").text());
  
});
{'fraction_non_alphanumeric': 0.19702338766832034, 'fraction_numerical': 0.002834868887313962, 'mean_word_length': 4.3893129770992365, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4700024', 'n_tokens_mistral': 457, 'n_tokens_neox': 448, 'n_words': 92}