Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there performance benefits to Angular's component style encapsulation?

I've been reading about Angular 2's style encapsulation methods where you can write your styles directly into the component.

This method can use the native shadow dom or an emulated one. What are the performance benefits to using either for component specific styles?

like image 235
Ben Racicot Avatar asked Jan 11 '17 01:01

Ben Racicot


1 Answers

It`s a pity, but there are performance problems with emulated styles encapsulation. The thing is, Angular uses attributes to apply CSS rules. And the use of them is not efficient, especially in the current version of Edge.

Here you can see some benchmarks as a proof. https://medium.com/@andreygoncharov/edge-hates-you-attributes-d15faf162939

So in 2017 maybe you should avoid using Angular styles encapsulation when developing big projects.

Here you can check the status of the issue.

like image 59
Mike Kovetsky Avatar answered Sep 28 '22 07:09

Mike Kovetsky