有谁知道为什么列出 Aurelia-Typescript 项目 in this git repository只能在 Chrome 浏览器上运行?
是否有 ES6 功能目前仅在 Chrome 上受支持,而在 IE 或 FireFox 上不受支持?
编辑 - 以下是来自 Firefox 34.0.5 的错误消息
改变一个对象的 [[Prototype]] 会导致你的代码运行非常缓慢; 而是使用 Object.create core.js:130 创建具有正确初始 [[Prototype]] 值的对象
未声明 HTML 文档的字符编码。如果文档包含 US-ASCII 范围之外的字符,则在某些浏览器配置中,文档将呈现为乱码文本。页面的字符编码必须在文档或传输协议(protocol)中声明。 index.html
“调试 [ Bootstrap ] 加载 HTMLImports polyfill” core.js:2518
Web 控制台日志记录 API(console.log、console.info、console.warn、console.error)已被此页面上的脚本禁用。
错误:脚本错误:webcomponentsjs/HTMLImports.min http://requirejs.org/docs/errors.html#scripterror require.js:166
最佳答案
在 aurelia-bundle.js 的第 15346 行( Bootstrap 部分),它检查是否支持 HTML 导入:
if (!("import" in document.createElement("link"))) {
logger.debug("loading the HTMLImports polyfill");
toLoad.push(System.normalize("webcomponentsjs/HTMLImports.min", loaderName).then(function (name) {
return System["import"](name);
}));
}
唯一开箱即用地支持它的浏览器仍然是 Chrome。对于其他浏览器,HTMLImports polyfill 加载失败,因为:
- webcomponentsjs 目录中缺少 HTMLImports.min.js
- 路径应该是“aurelia/webcomponentsjs/HTMLImports.min”。将 webcomponentsjs 移动到根路径可能会更好(我不知道如何通过捆绑处理)
- 按照@Chi Row 对 HTML 模板元素 polyfill 的回答(IE 11 似乎支持它们,所以它在没有它们的情况下工作)。
关于typescript - Aurelia Typescript 项目仅适用于 Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28796657/