What's the substitute for ::shadow and /deep/?

后端 未结 4 1257
滥情空心
滥情空心 2020-12-05 17:49

The two shadow-piercing combinators have been deprecated as stated in https://www.chromestatus.com/features/6750456638341120
Then what\'s the substitude for achieving the

4条回答
  •  眼角桃花
    2020-12-05 18:24

    ::shadow and /deep/ were removed for breaking encapsulation.

    The substitutes are:

    • CSS variables. It already works natively with the recently launched Google Chrome 49. Read here:
      1. http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201/
      2. https://developers.google.com/web/updates/2016/02/css-variables-why-should-you-care?hl=en
      3. http://blog.chromium.org/2016/02/chrome-49-beta-css-custom-properties.html
    • :host-context. Read here: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201/

提交回复
热议问题