【发布时间】:2014-04-06 04:55:18
【问题描述】:
在 Done 函数中,err 对象有一个错误,即 "TypeError: Object # has no method 'run' in file 'http://code.jquery.com/jquery.js'"。
var jsdom = require('jsdom-nogyp');
jsdom.env({
html: '<html><body></body></html>',
scripts: ['http://code.jquery.com/jquery.js'],
done: function (err, window) {
if (err)
throw (err);
var $ = window.jQuery;
$('body').append("<div class='testing'>Hello World</div>");
console.log($(".testing").text()); // outputs Hello World
}
});
【问题讨论】: