- Mastering Angular Components
- Gion Kunz
- 145字
- 2021-07-23 17:23:38
Shadow DOM
This part of the web components specification was the missing piece to create proper DOM encapsulation and composition. With shadow DOM, we can create isolated parts of the DOM that are protected against regular DOM operations from the outside. Also, CSS will not reach into shadow DOM automatically, and we can create local CSS within our component.
If you add a style tag inside shadow DOM, the styles are scoped to the root within the shadow DOM, and they will not leak outside. This enables a very strong encapsulation for CSS.
Content insertion points make it easy to control content from the outside of a shadow DOM component, and they provide some kind of an interface to pass in content.
At the time of writing this book, shadow DOM is supported by most browsers, although it still needs to be enabled in Firefox.
推薦閱讀
- 數(shù)字烏托邦
- 電子政務(wù)效益的經(jīng)濟(jì)分析與評(píng)價(jià)
- 物聯(lián)網(wǎng)之魂:物聯(lián)網(wǎng)協(xié)議與物聯(lián)網(wǎng)操作系統(tǒng)
- Learning QGIS 2.0
- Web Application Development with R Using Shiny
- 物聯(lián)網(wǎng)概論(第2版)
- Windows Server 2003 Active Directory Design and Implementation: Creating, Migrating, and Merging Networks
- SD-WAN架構(gòu)與技術(shù)(第2版)
- 互聯(lián)網(wǎng)安全的40個(gè)智慧洞見:2015年中國互聯(lián)網(wǎng)安全大會(huì)文集
- 物聯(lián)網(wǎng)安全技術(shù)
- Yii Application Development Cookbook(Second Edition)
- Mastering Dart
- 基于性能的保障理論與方法
- Master Apache JMeter:From Load Testing to DevOps
- 從實(shí)踐中學(xué)習(xí)手機(jī)抓包與數(shù)據(jù)分析