feat(core): add support for ShadowDOM v1 (#24718)
add a new ViewEncapsulation.ShadowDom option that uses the v1 Shadow DOM API to provide style encapsulation. PR Close #24718
This commit is contained in:

committed by
Miško Hevery

parent
1ae3f87383
commit
3553977bd7
35
packages/examples/core/ts/metadata/encapsulation.ts
Normal file
35
packages/examples/core/ts/metadata/encapsulation.ts
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Component, ViewEncapsulation} from '@angular/core';
|
||||
|
||||
// #docregion longform
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
template: `
|
||||
<h1>Hello World!</h1>
|
||||
<span class="red">Shadow DOM Rocks!</span>
|
||||
`,
|
||||
styles: [`
|
||||
:host {
|
||||
display: block;
|
||||
border: 1px solid black;
|
||||
}
|
||||
h1 {
|
||||
color: blue;
|
||||
}
|
||||
.red {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
`],
|
||||
encapsulation: ViewEncapsulation.ShadowDom
|
||||
})
|
||||
class MyApp {
|
||||
}
|
||||
// #enddocregion
|
Reference in New Issue
Block a user