jsdom hashchange事件
在jsdom文件上:
document = require('jsdom').jsdom("<html><head></head><body></body></html>"); window = document.createWindow();
改变它的散列:
document.location.href = '#bang';
不会在window
上触发任何'hashchange'
事件
有没有人知道这个解决方法?
谢谢
查看jsdom文档
在你的其他代码之前试试这个:
require('jsdom').defaultDocumentFeatures = { FetchExternalResources : ['script'], ProcessExternalResources : ['script'], MutationEvents : '2.0', QuerySelector : false } var window = jsdom.jsdom(body).createWindow();