【发布时间】:2017-10-03 18:25:54
【问题描述】:
我正在尝试为 Firefox 启用 Polymer Web 组件,以便可以在 Firefox 上浏览我的 Polymer 网页。
我尝试了这些说明,但没有任何改变,而且 Firefox 似乎完全忽略了我的组件。
https://www.designedbyaturtle.co.uk/2015/how-to-enable-web-components-in-firefox-shadow-dom/
我还在我的index.html 中导入了webcomponents.js polyfill。
所以,我所做的如下:
我在elements目录下写了如下web组件test-firefox.html:
<dom-module name="test-firefox">
<template>
<h2>Firefox says hi too!</h2>
</template>
<script>
Polymer({
is: 'test-firefox'
});
</script>
</dom-module>
这是我的index.html 文件:
<!doctype html>
<html>
<head>
<link rel="import" href="webjars/polymer/1.6.1/polymer.html">
<script src="webjars/webcomponentsjs/0.7.22/webcomponents.js"></script>
<script src="webjars/webcomponentsjs/0.7.22/webcomponents-lite.min.js"></script>
<link rel="import" href="elements/test-firefox.html">
</head>
<body>
<h1>Hello Firefox!</h1>
<test-firefox></test-firefox>
</body>
</html>`
如您所见,我使用的是对应的webjars(用于Polymer、webcomponents.js、webcomponents-lite.min.js)而不是bower_components。我已经在pom.xml 中添加了依赖项,它们通常已安装。
所以我注意到发生的事情很奇怪:
- 对于 Google Chrome,一切正常。
- 对于 Linux 上的 Mozilla Firefox,同样如此。
- 对于 Win10 上的 Mozilla Firefox,Web 组件没有被渲染,就像浏览器完全忽略它一样。
有什么想法吗?
【问题讨论】:
标签: firefox compatibility polymer-1.0 webjars