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

2019-01-18 01:51发布

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 same thing, or this shadow-piercing feature has been completely abandoned?

2条回答
对你真心纯属浪费
2楼-- · 2019-01-18 02:27

The problem is that ::shadow and /deep/ break encapsulation. I am glad they are gone.

The good substitutes are:

查看更多
劳资没心,怎么记你
3楼-- · 2019-01-18 02:52

As of Polymer 2:

  • ::shadow (shadow-piercing selectors) - there is no direct substitute. Instead a custom CSS properties has to be used. Polymer 2: Custom CSS Properties

  • /deep/ - there is some sort of replacement by defining :host > * { ... } (applies a ruleset to all of the top-level children in the host's shadow tree, which doesn't conflict with the rule in the main document).

For more detailed information check Polymer 2 Upgrade Notes

查看更多
登录 后发表回答