Created
June 5, 2012 22:13
-
-
Save Trindaz/2878441 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsdom = require('jsdom'); | |
var body1="<html><head>"+ | |
"<script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?key=***key***&sensor=false'></script>"+ | |
"<script type='text/javascript' src='https://raw.github.com/gist/2878326/f2d5d46b07a9f425870fa025c2cfbeb379c41a67/gistfile1.js'></script></head>"+ | |
"<script>functions testMe(){ var a = 1;}</script>" | |
"<body>" | |
"<div><form id='addressform'>"+ | |
"<input id='address' class='address' type='textbox' value='1 Market St, San Francisco'>"+ | |
"<input id='test' class='test' type='textbox' value='not tested'></form></div></body>"+ | |
"</html>"; | |
jsdom.env({ | |
html: | |
body1, | |
scripts: | |
[ | |
'http://code.jquery.com/jquery-1.5.min.js' | |
], | |
done: | |
function (err, window) { | |
try{ | |
window.testMe(); //this line breaks | |
console.log(window.$('html').html()); | |
}catch(err){ | |
console.log(err); | |
} | |
}, | |
features : | |
{ | |
FetchExternalResources : ['script'], | |
ProcessExternalResources : ['script'] | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment