Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add support for ShadowDOM v1 #24718

Closed
wants to merge 1 commit into from

Conversation

robwormald
Copy link
Contributor

@robwormald robwormald commented Jun 29, 2018

Partially resolves #23636 - it adds a new ViewEncapsulation option which uses the modern Shadow DOM API - .attachShadow({ mode: 'open' })

This should allow Angular Elements to be used in combination with <slot> elements for basic native content projection.

ViewEncapsulation.Shadow is added as a new API, rather than changing the behavior of the ViewEncapsulation.Native option, which could lead to unexpected results for developers currently using the v0 API.

This should (eventually?) deprecate the ViewEncapsulation.Native option.

@robwormald robwormald requested a review from mhevery June 29, 2018 17:32
@robwormald robwormald added the target: patch This PR is targeted for the next patch release label Jun 29, 2018
@mary-poppins
Copy link

You can preview e7dd025 at https://pr24718-e7dd025.ngbuilds.io/.

@@ -23,6 +23,7 @@ export enum ViewEncapsulation {
*/
Emulated = 0,
/**
* @deprecated use {ViewEncapsulation.ShadowDom}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deprecated v4.0.0 - use {ViewENcapsulation.ShadowDom}

@@ -20,7 +20,8 @@ import {NAMESPACE_URIS} from '../../src/dom/dom_renderer';
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
TestCmp, SomeApp, CmpEncapsulationEmulated, CmpEncapsulationNative, CmpEncapsulationNone
TestCmp, SomeApp, CmpEncapsulationEmulated, CmpEncapsulationNative, CmpEncapsulationNone,
CmpEncapsulationNative
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add more tests demonstrating the full usage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a suite

@robwormald robwormald force-pushed the shadow-dom-v1-2 branch 2 times, most recently from 73948ea to 163e6a5 Compare June 29, 2018 23:21
@mary-poppins
Copy link

You can preview 73948ea at https://pr24718-73948ea.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 163e6a5 at https://pr24718-163e6a5.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 323d332 at https://pr24718-323d332.ngbuilds.io/.

*
* For the DOM this means using modern [Shadow
* DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
* creating a ShadowRoot for Component's Host Element.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to make sure that all new documentation is up to new standard. Can you add example of how to use it. Here is an example of how to add an example https://github.com/angular/angular/blob/master/packages/core/src/application_ref.ts#L461

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks kinda funky in the table, but let's go with it https://pr24718-65902db.ngbuilds.io/api/core/ViewEncapsulation

@robwormald robwormald force-pushed the shadow-dom-v1-2 branch 2 times, most recently from 0d87aff to 65902db Compare June 30, 2018 17:40
add a new ViewEncapsulation.ShadowDom option that uses the v1 Shadow DOM API to provide style encapsulation.
@mary-poppins
Copy link

You can preview 65902db at https://pr24718-65902db.ngbuilds.io/.

@mary-poppins
Copy link

You can preview afe3494 at https://pr24718-afe3494.ngbuilds.io/.

@mhevery mhevery added merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note action: merge The PR is ready for merge by the caretaker and removed merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Jul 2, 2018
mhevery pushed a commit that referenced this pull request Jul 2, 2018
add a new ViewEncapsulation.ShadowDom option that uses the v1 Shadow DOM API to provide style encapsulation.

PR Close #24718
@mhevery mhevery closed this in 3553977 Jul 2, 2018
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes freq1: low target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Shadow DOM V1
5 participants