jsdom.env({
html: "<html><body></body></html>",
scripts: [
//'http://code.jquery.com/jquery-1.5.min.js'
'http://server.local:3000/jquery/jquery.min.js'
]
}, function (err, window) {
Run Code Online (Sandbox Code Playgroud)
它不起作用脚本是'http://server.local:3000/jquery/jquery.min.js'(使用浏览器可用)jquery.min.js是jquery-1.5.min.js的副本
如果脚本是'http://code.jquery.com/jquery-1.5.min.js' - 一切正常.
怎么了?
这不是你问题的直接答案,但也许其他人像我一样来到这个问题.
您可以在脚本条目中指定本地文件.只需在其中放置绝对路径或添加documentRoot条目并使用相对路径.例如
jsdom.env({
html: "<html><body></body></html>",
documentRoot: __dirname + '/lib',
scripts: [
'jquery/jquery.min.js'
]
}, function (err, window) {
}
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2895 次 |
| 最近记录: |