我正在尝试为Firefox启用Polymer Web组件,以便我可以浏览Firefox上的Polymer网页。
我尝试了这些说明,但没有任何改变,似乎Firefox完全忽略了我的组件。
https://www.designedbyaturtle.co.uk/2015/how-to-enable-web-components-in-firefox-shadow-dom/
我也在我的webcomponents.js
中导入index.html
polyfill。
所以,我所做的是以下内容:
我在目录test-firefox.html
中编写了以下Web组件elements
:
<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>`
正如您所看到的,我使用的是相应的bower_components
(webjars
,Polymer
,webcomponents.js
)而不是webcomponents-lite.min.js
。我已经为pom.xml
中的那些添加了依赖项,它们通常已安装。
所以我注意到这种情况很奇怪:
有什么想法吗?
答案 0 :(得分:0)
你可以改写你的问题吗?
您无需启用任何内容即可让网站在Firefox中运行(当然您可以访问https://www.polymer-project.org/并且它适用于您)。
如果firefox“忽略”你的组件,那么你可能缺少这些元素的导入。
查看此页面https://www.polymer-project.org/1.0/docs/devguide/registering-elements,了解如何使用<link rel="import" href="bower_components/polymer/polymer.html">
。您还需要以这种方式导入自己的组件才能使用它们。