Angular 2使用Shadow DOM还是Virtual DOM? [英] Does Angular 2 use Shadow DOM or a Virtual DOM?

查看:1599
本文介绍了Angular 2使用Shadow DOM还是Virtual DOM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Angular 2用什么来更新DOM.是Shadow DOM还是Virtual DOM? Angular 1中有这样的概念吗?

What does Angular 2 use to update the DOM. Is it Shadow DOM or Virtual DOM ? Was there any such concept in Angular 1?

推荐答案

更新

现在直接支持影子DOM.

Shadow DOM is now directly supported.

原始

Angular2不使用阴影DOM (默认),也不使用虚拟DOM .

Angular2 doesn't use shadow DOM (default) nor virtual DOM.

使用encapsulation: ViewEncapsulation.Emulated(默认设置)时,没有阴影DOM ,因为仅模拟样式封装.

With encapsulation: ViewEncapsulation.Emulated (default) there is no shadow DOM because style encapsulation is only emulated.

encapsulation: ViewEncapsulation.Native在本身支持它的浏览器中启用阴影DOM ,或者在加载webcomponents polyfill时再次对其进行仿真.

encapsulation: ViewEncapsulation.Native enables shadow DOM on browsers that support it natively or it's again emulated when the webcomponents polyfill is loaded.

影子DOM 也不像虚拟DOM那样以性能为目标,而是样式封装.

Shadow DOM is also not targeting performance as virtual DOM is, but style encapsulation.

Angular2完全不使用虚拟DOM .

Angular2 doesn't use virtual DOM at all.

Angular2具有更改检测功能,该功能可以检测模型的更改,并仅根据模型更改更新需要更改的DOM部分.

Angular2 has change detection that detects changes to the model and only updates the parts of the DOM that need to be changed according to the model changes.

有关更多详细信息,另请参见 Shadow DOM像React.js中的Virtual DOM一样快吗?

For more details see also Is Shadow DOM fast like Virtual DOM in React.js?

这篇关于Angular 2使用Shadow DOM还是Virtual DOM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆