HTML Import webcomponents polyfill not working in firefox

三世轮回 提交于 2019-12-02 12:37:42

To use, in Firefox, Custom Elements v1 with HTML Imports:

  1. Do not activate Firefox flags as the implementation is outdated.
  2. Install webcomponentsjs (with bower for example), and include in your main file only htmlimports.min.js file.
  3. Install custom-elements (from your link) and include in your main file custom-elements.min.js.

You main page should look like this:

<head>
   <script src="htmlimports.min.js"></script>
   <script src="custom-elements.min.js"></script>
   <link rel="import" href="your-components.html">
</head>
<body>
    <your-component></your-component>

NB: for step 3, you can also use document-register-element.


You cannot use Custom Elements v1 class syntax with Internet Explorer directly because class is not implemented. You'll need first to transform the source code with a transpiler like Babel.

Alternately, use a modern version (Edge), or use the prototype syntax.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!