ViewEncapsulation.Native -> ng2 should bring polyfill for shadow dom
hey team,
angular2 should bring a polyfill for ShadowDOM. When enabling ViewEncapsulation.Native, most of the browsers will not be able to render the app due to the lack of ShadowDOM support.
IMO ng2 should package and bring polymer or webcomponentsjs with angular2-polyfills.js, so developers have no need to pull another dependency to get the angular2 app working
I don't think we want to package either polymer or webcomponentsjs with angular2 polyfills as the default view encapsulation is emulated and the majority of apps will use that.
But we should definitely mention/document, when native view encapsulation is used, that people have to take care of polyfilling if needed.
Hmm, it depends from the point of view... I mean if there is an angular2-polyfills.js it should be so kind and bring all the polyfills that are required no matter which settings devs use on their components.
But, yes! at least it should be mentioned within the docs
it should be so kind and bring all the polyfills that are required no matter which settings devs use on their components.
I disagree here. We can't build and ship polyfills for IE8 because there's a chance that people try to use Angular in that browser. Neither we should ship polyfills by default for sth. that is not needed for the majority of apps. That comes with a cost of file size.
I think as soon as people switch to native view encapsulation, they know what they're dong and are aware of the consequences, including making sure that polyfills are available.
OTOH, specifically in the case of Shadow DOM, I don't think that devs need/want polyfills when they use native view encapsulation, exactly because you'd have to polyfill it for too many platforms. So if your target browser isn't a browser that supports native shadow DOM, you're better of to use emulated view encapsulation anyways. That thing is basically a polyfill.
We can't build and ship polyfills for IE8 because there's a chance that people try to use Angular in that browser. Neither we should ship polyfills by default for sth. that is not needed for the majority of apps.
well this argument is not true, there is a browser support matrix which says ng2 is compatible with browser x,y,z.. (https://angular.io/features.html)
That comes with a cost of file size.
true, size would be the disadvantage
I don't think that devs need/want polyfills when they use native view encapsulation
True in the happy path.
But not all users in the wild are using chrome. there are plenty people out there using latest and greatest firefox of edge which don't support ShadowDOM (okay, firefox has a flag that can be used to turn it on) but for public facing web apps. there are plenty of scenarios where you want to get Shadow DOM working.
Anyway, IMO polyfills should ship it :smile: and docs should mention it
well this argument is not true, there is a browser support matrix which says ng2 is compatible with browser x,y,z.. (https://angular.io/features.html)
Right, but you'll need polyfills for older ones too.
True in the happy path. But not all users in the wild are using chrome. there are plenty people out there using latest and greatest firefox of edge which don't support ShadowDOM (okay, firefox has a flag that can be used to turn it on) but for public facing web apps. there are plenty of scenarios where you want to get Shadow DOM working.
Again, if you need to polyfill it for the broader platform anyways, rather stick with emulated view encapsulation. It is already the polyfill.
It is already the polyfill.
That said, it should internally fallback to Native if browser supports it. Shouldn't it?
Generally, a polyfill is usually the fallback in case the native implementation is not supported.
However, in this case Shadow DOM support is disabled by default as it comes with a performance penalty that's not necessarily worth it. Which is why you'd have to turn it on explicitly.
hmkay. Performance may really be the point, because of another SSL handshake might be done for the ShadowDOM content.
Uhm.. not sure how SSL is related to this.
same here, but that's something I will look into
So ShadowDOM is entirely client-side based and has actually nothing todo with SSL. However, that's not related to your original issue anyways.
true, let's keep it that way that docs should at least be updated
SSL dependes of course on what is done inside of the Component
Native an emulated does not have identical behaviours, so fallbacking to native if it exists will lead to inconsistencies between browsers. It's better to make a conscious choice which one you want and then go with that on all browsers.
I need to side with @PascalPrecht here: we don't (and often can't from the practical point of view) package and ship all the polyffils that one might need. IMO it is better that people got control over what is loaded with they app.
There are other discussions around shipping polyffils and other issues are raised in #7390.
I'm going to close this one for now, we might re-open if our thinking changes in the future.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.