Zombiejs jQuery nullTypeError’compareDocumentPosition’

Zombie:无法读取属性’compareDocumentPosition’的null TypeError:无法读取null的属性’compareDocumentPosition’

每当我尝试使用Zombiejs加载包含jQuery的页面时,就会发生这种情况。 这在Debian和Windows上发生,包含各种不同的页面,使用不同版本的jQuery,页面上没有别的东西。

它似乎与jsDom在页面文档准备好之前评估jQuery的方式有关,但它远远超出了我的想象。

任何人遇到这个,知道解决方法,或有任何指针? 谢谢!

更新:这是我的测试(实际通过,但运行调试显示我提到的错误):

zombie = require "zombie" browser = new zombie.Browser({debug: false}) $ = require "jquery" require "should" app = "http://localhost:3000/" describe "app", -> describe "index", -> it "should display correct title", (done) -> browser.visit app, (err, browser) -> done() 

这是错误:

 Zombie: GET http://localhost:3000/js/jquery-1.7.1.js => 200 Zombie: Cannot read property 'compareDocumentPosition' of null TypeError: Cannot read property 'compareDocumentPosition' of null at Object. (/js/jquery-1.7.1.js:4807:30) at Object. (/js/jquery-1.7.1.js:5301:2) at Object. (/js/jquery-1.7.1.js:9266:2) at Object._evaluate (/home/dev/Hg/rpg-chat-bdd/node_modules/zombie/lib/zombie/browser.js:136:28) in /js/jquery-1.7.1.js 

这会导致其他错误,因为在我的其余脚本中没有定义’$’。

这是我正在测试的页面的HTML:

 Welcome to Test!  

这是黑暗中的镜头,但我克隆了https://github.com/assaf/zombie.git并为compareDocumentPosition进行了grepped。 在文件中找到的第一行是这样的:

 if ( document.documentElement.compareDocumentPosition ) { 

现在,document.documentElement通常指向 -tag,你可能错过了吗?