One thing I learned today — 9 January 2018

Niel de Wet
1 min readJan 9, 2018

--

In our Angular 2+ application we’re using the shadow-piercing descendant combinator /deep/ along with host pretty much everywhere where we want to modify the styles of descendant components. Then I learned that /deep/ and its synonym, >>>, are being deprecated by Angular, Sass, and browsers (in the Shadow DOM v0).

This caused a lot of uncertainty, especially because Chrome 63 was released but our apps still work fine, until I learned that by default Angular 2+ emulates view encapsulation:

encapsulation: ViewEncapsulation.Emulated

This means that actually there is no need to panic. The emulation doesn’t make use of the deprecated features. However, the Angular documentation states that these, along with ::ng-deep are all deprecated, but the consensus on the web seems to be that ::ng-deep is the lessor evil and should be used for now.

--

--

No responses yet