2
我似乎無法得到jsdom執行外部腳本,我似乎無法找到任何具體的例子。當我打電話給我的測試功能時,我沒有收到任何錯誤,但沒有任何反應。jsdom沒有加載外部資源
這是我的代碼:
var window = jsdom.jsdom(body).createWindow();
jsdom.jQueryify(window, './lib/jquery.js', function() {
console.log(window.$("#a1").text());
window.testing();
console.log(window.$("#a2").text());
});
這是HTML它的加載:
<html>
<head>
<script type="text/javascript" src="stuff.js"></script>
</head>
<body>
Hi there
<div id="a1">
</div>
<div id="a2">
</div>
</body>
</html>
我的測試功能:
function testing() {
var a2 = document.getElementById("a2");
a2.innerHTML = 'Second div';
console.log("executed");
}
這個答案是最新的更新錯後。 MutationEvents需要是「2.0」而不是false。 – 2012-01-20 07:32:06
@BjornTipling更新:) – DTrejo 2012-01-22 00:35:53