我正在测试 Anuglar Elements 以创建一些 Web 组件并且运行良好。无论如何,我在控制台中收到此警告:
[Deprecation] Element.createShadowRoot is deprecated and will be removed in M73, around March 2019. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 for more details.
相关文件是platform-browser.js:1182。 我应该注意什么吗?我该如何解决?我应该寻找替代方法来创建我的 Web 组件吗?
最佳答案
根据 MDN Web 文档,此功能将被完全删除。在任何情况下,大多数网络浏览器都不支持它:
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
Deprecated
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
如果您使用的是 Angular,我建议您使用 Dynamic Component Loader
关于javascript - Angular 元素 - Element.createShadowRoot 弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56461710/