Skip to content

Commit d9f0e6b

Browse files
committed
Revert "feat(platform-browser): Add IsolatedShadowDom encapsulation method (#62723)" (#63142)
This reverts commit d24d574. A legitimate issue was raised in the original commit (see d24d574#commitcomment-163853393) PR Close #63142
1 parent 767a280 commit d9f0e6b

File tree

20 files changed

+39
-190
lines changed

20 files changed

+39
-190
lines changed

adev/shared-docs/pipeline/api-gen/rendering/test/fake-cli-entries.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@
177177
"enum": [
178178
"Emulated",
179179
"None",
180-
"ShadowDom",
181-
"IsolatedShadowDom"
180+
"ShadowDom"
182181
],
183182
"description": "The view encapsulation strategy to use in the new application."
184183
}
@@ -368,8 +367,7 @@
368367
"enum": [
369368
"Emulated",
370369
"None",
371-
"ShadowDom",
372-
"IsolatedShadowDom"
370+
"ShadowDom"
373371
],
374372
"description": "The view encapsulation strategy to use in the new component."
375373
}

adev/src/app/features/update/recommendations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ export const RECOMMENDATIONS: Step[] = [
10321032
level: ApplicationComplexity.Advanced,
10331033
step: 'viewencapsulation native removed',
10341034
action:
1035-
'The component view encapsulation option `ViewEncapsulation.Native` has been removed. Use `ViewEncapsulation.ShadowDom` or `ViewEncapsulation.IsolatedShadowDom` instead. `ng update` will migrate you automatically.',
1035+
'The component view encapsulation option `ViewEncapsulation.Native` has been removed. Use `ViewEncapsulation.ShadowDom` instead. `ng update` will migrate you automatically.',
10361036
},
10371037
{
10381038
possibleIn: 1100,

adev/src/content/ai/mcp-server-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ This tool lists all the applications and libraries in your current Angular works
9090

9191
## Feedback and New Ideas
9292

93-
The Angular team welcomes your feedback on the existing MCP capabilities and any ideas you have for new tools or features. Please share your thoughts by opening an issue on the [angular/angular GitHub repository](https://github.com/angular/angular/issues).
93+
The Angular team welcomes your feedback on the existing MCP capabilities and any ideas you have for new tools or features. Please share your thoughts by opening an issue on the [angular/angular GitHub repository](https://github.com/angular/angular/issues).

adev/src/content/cli/help/generate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,4 +998,4 @@
998998
"deprecated": false
999999
}
10001000
]
1001-
}
1001+
}

adev/src/content/cli/help/new.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,4 @@
195195
"description": "Create an initial application that does not utilize `zone.js`."
196196
}
197197
]
198-
}
198+
}

adev/src/content/guide/animations/complex-sequences.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ IMPORTANT: If you need to animate the items of an `*ngFor` list and there is a p
121121

122122
## Animations and Component View Encapsulation
123123

124-
Angular animations are based on the components DOM structure and do not directly take [View Encapsulation](guide/components/styling#style-scoping) into account, this means that components using `ViewEncapsulation.Emulated` behave exactly as if they were using `ViewEncapsulation.None` (`ViewEncapsulation.ShadowDom` and `ViewEncapsulation.IsolatedShadowDom` behave differently as we'll discuss shortly).
124+
Angular animations are based on the components DOM structure and do not directly take [View Encapsulation](guide/components/styling#style-scoping) into account, this means that components using `ViewEncapsulation.Emulated` behave exactly as if they were using `ViewEncapsulation.None` (`ViewEncapsulation.ShadowDom` behaves differently as we'll discuss shortly).
125125

126126
For example if the `query()` function (which you'll see more of in the rest of the Animations guide) were to be applied at the top of a tree of components using the emulated view encapsulation, such query would be able to identify (and thus animate) DOM elements on any depth of the tree.
127127

128-
On the other hand the `ViewEncapsulation.ShadowDom` and `ViewEncapsulation.IsolatedShadowDom` changes the component's DOM structure by "hiding" DOM elements inside [`ShadowRoot`](https://developer.mozilla.org/docs/Web/API/ShadowRoot) elements. Such DOM manipulations do prevent some of the animations implementation to work properly since it relies on simple DOM structures and doesn't take `ShadowRoot` elements into account. Therefore it is advised to avoid applying animations to views incorporating components using the ShadowDom view encapsulation.
128+
On the other hand the `ViewEncapsulation.ShadowDom` changes the component's DOM structure by "hiding" DOM elements inside [`ShadowRoot`](https://developer.mozilla.org/docs/Web/API/ShadowRoot) elements. Such DOM manipulations do prevent some of the animations implementation to work properly since it relies on simple DOM structures and doesn't take `ShadowRoot` elements into account. Therefore it is advised to avoid applying animations to views incorporating components using the ShadowDom view encapsulation.
129129

130130
## Animation sequence summary
131131

@@ -141,4 +141,4 @@ You might also be interested in the following:
141141
<docs-pill href="guide/animations/transition-and-triggers" title="Transition and triggers"/>
142142
<docs-pill href="guide/animations/reusable-animations" title="Reusable animations"/>
143143
<docs-pill href="guide/routing/route-transition-animations" title="Route transition animations"/>
144-
</docs-pill-row>
144+
</docs-pill-row>

adev/src/content/guide/components/styling.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ and [stylus](https://stylus-lang.com).
3636
## Style scoping
3737

3838
Every component has a **view encapsulation** setting that determines how the framework scopes a
39-
component's styles. There are four view encapsulation modes: `Emulated`, `ShadowDom`, `IsolatedShadowDom`, and `None`.
39+
component's styles. There are three view encapsulation modes: `Emulated`, `ShadowDom`, and `None`.
4040
You can specify the mode in the `@Component` decorator:
4141

4242
<docs-code language="angular-ts" highlight="[3]">
@@ -82,20 +82,16 @@ using [the web standard Shadow DOM API](https://developer.mozilla.org/docs/Web/W
8282
When enabling this mode, Angular attaches a shadow root to the component's host element and renders
8383
the component's template and styles into the corresponding shadow tree.
8484

85-
Styles inside the shadow tree cannot affect elements outside of that shadow tree.
85+
This mode strictly guarantees that _only_ that component's styles apply to elements in the
86+
component's template. Global styles cannot affect elements in a shadow tree and styles inside the
87+
shadow tree cannot affect elements outside of that shadow tree.
8688

8789
Enabling `ShadowDom` encapsulation, however, impacts more than style scoping. Rendering the
8890
component in a shadow tree affects event propagation, interaction
8991
with [the `<slot>` API](https://developer.mozilla.org/docs/Web/Web_Components/Using_templates_and_slots),
9092
and how browser developer tools show elements. Always understand the full implications of using
9193
Shadow DOM in your application before enabling this option.
9294

93-
### ViewEncapsulation.IsolatedShadowDom
94-
95-
Behaves as above, except this mode strictly guarantees that _only_ that component's styles apply to elements in the
96-
component's template. Global styles cannot affect elements in a shadow tree and styles inside the
97-
shadow tree cannot affect elements outside of that shadow tree.
98-
9995
### ViewEncapsulation.None
10096

10197
This mode disables all style encapsulation for the component. Any styles associated with the
@@ -118,4 +114,4 @@ use [the `<link>` element](https://developer.mozilla.org/docs/Web/HTML/Element/l
118114
reference CSS files. Additionally, your CSS may
119115
use [the `@import`at-rule](https://developer.mozilla.org/docs/Web/CSS/@import) to reference
120116
CSS files. Angular treats these references as _external_ styles. External styles are not affected by
121-
emulated view encapsulation.
117+
emulated view encapsulation.

adev/src/content/reference/migrations/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ Learn about how you can migrate your existing angular project to the latest feat
3030
<docs-card title="Self-closing tags" link="Migrate now" href="reference/migrations/self-closing-tags">
3131
Convert component templates to use self-closing tags where possible.
3232
</docs-card>
33-
</docs-card-container>
33+
</docs-card-container>

devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/property-tab/component-metadata.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class ComponentMetadataComponent {
3636

3737
private _nestedProps = inject(ElementPropertyResolver);
3838

39-
angularViewEncapsulationModes = ['Emulated', 'Native', 'None', 'ShadowDom', 'IsolatedShadowDom'];
39+
angularViewEncapsulationModes = ['Emulated', 'Native', 'None', 'ShadowDom'];
4040
acxViewEncapsulationModes = ['Emulated', 'None'];
4141

4242
readonly controller = computed(() => {

goldens/public-api/core/index.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,6 @@ export abstract class ViewContainerRef {
20222022
// @public
20232023
export enum ViewEncapsulation {
20242024
Emulated = 0,
2025-
IsolatedShadowDom = 4,
20262025
None = 2,
20272026
ShadowDom = 3
20282027
}

0 commit comments

Comments
 (0)