【问题标题】:/deep/ combinator in CSS is deprecated and will be removed in M63CSS 中的 /deep/ 组合器已弃用,将在 M63 中删除
【发布时间】:2018-05-01 03:10:21
【问题描述】:

我将 angular 更新为 4.0.0,将 chrome 更新为 62.0.3202.94,但出现此错误:

[弃用] CSS 中的 /deep/ 组合器已弃用,并将在 2017 年 12 月左右在 M63 中删除。有关详细信息,请参阅 https://www.chromestatus.com/features/4964279606312960

在我的代码中是指clientWidthclientHeight

document.getElementById(this.ID).clientWidth;

或这里:

document.documentElement.scrollTop = parseInt(sessionStorage.getItem('scrollPosition'), 10);

浏览器是否误解了这个错误?如何解决这个问题?

【问题讨论】:

    标签: html css angular


    【解决方案1】:

    更新

    ::slotted 现在被所有新浏览器支持并且可以与 `ViewEncapsulation.ShadowDom 一起使用

    https://developer.mozilla.org/en-US/docs/Web/CSS/::slotted

    原创

    /deep/ 在任何浏览器中被弃用与 Angular 完全无关。

    Angular 会重写选择器,以便在加载应用程序时不使用/deep/ 或更新的替换::ng-deep

    /deep/::ng-deep 只是提示 Angular 不包含唯一类(如 _ngcontent-1),Angular 在 CSS 选择器中添加到每个组件宿主元素。

    另见https://blog.thoughtram.io/angular/2015/06/29/shadow-dom-strategies-in-angular2.html

    【讨论】:

    • 我想我明白了。感谢您的解释。
    猜你喜欢
    • 2021-01-07
    • 1970-01-01
    • 1970-01-01
    • 2016-01-06
    • 2020-08-11
    • 2016-07-10
    • 2023-03-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多