如何处理 Polymer v1 中的 document.registerElement 弃用?

How to handle document.registerElement deprecation in Polymer v1?

在浏览器控制台中,我看到:

[Deprecation] document.registerElement is deprecated and will be removed in M73, around March 2019. Please use window.customElements.define instead. See https://www.chromestatus.com/features/4642138092470272 for more details.

它来自 polymer-micro.html:443,它来自我项目中的 Polymer 1.11.3 包。我相信这是最新的 v1 版本。

如何在不将 Polymer 更新到 v2 的情况下处理此问题?我尝试更新到 Polymer 2,但它在运行时失败了。我猜 api 变了。

为了使基于 polymer v1 的组件能够与最新版本的现代浏览器一起使用,您应该在主 html

中以类似于此的方式添加 Web Components v0 polyfill
<script src="/bower_components/webcomponentsjs/webcomponents-lite-min.js"></script>

有关此的更多信息,请查看聚合物团队的 blog post