javascript - Angular 元素 - Element.createShadowRoot 弃用

标签 javascript angular deprecation-warning angular-elements

我正在测试 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-b​​rowser.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/

相关文章:

angular - 在 Angular 中意外关闭 Material 对话框之前确认消息?

node.js - Angular:ngModel 插值在输入文本框中返回 NaN。如何显示号码

javascript - React-native 自动完成问题 ("Objects are not valid as a Reach child")

javascript - 音频文件数组

javascript - 更新在另一个对象中使用的对象

objective-c - 使用@available 抑制 Objective-C 中的弃用警告

symfony - 为什么 Symfony 3.3.13 源代码会生成弃用警告(不在我的代码中)?

node.js - 弃用警告 : Listening to events on the Db class has been deprecated and will be removed in the next major version

javascript - 如何使用 jQuery 切换变量文字(值)

javascript - 制作动态图像跟随鼠标