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

fix: patchChildSlotNodes & scopedSlotTextContentFix not being applied #6055

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/compiler/config/validate-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ export const validateConfig = (
validatedConfig.extras.scriptDataOpts = !!validatedConfig.extras.scriptDataOpts;
validatedConfig.extras.initializeNextTick = !!validatedConfig.extras.initializeNextTick;
validatedConfig.extras.tagNameTransform = !!validatedConfig.extras.tagNameTransform;
// TODO(STENCIL-1086): remove this option when it's the default behavior
validatedConfig.extras.experimentalScopedSlotChanges = !!validatedConfig.extras.experimentalScopedSlotChanges;

// TODO(STENCIL-914): remove when `experimentalSlotFixes` is the default behavior
// If the user set `experimentalSlotFixes` and any individual slot fix flags to `false`, we need to log a warning
Expand All @@ -160,6 +162,7 @@ export const validateConfig = (
'slotChildNodesFix',
'cloneNodeFix',
'scopedSlotTextContentFix',
'experimentalScopedSlotChanges',
];
const conflictingFlags = possibleFlags.filter((flag) => validatedConfig.extras[flag] === false);
if (conflictingFlags.length > 0) {
Expand All @@ -185,9 +188,6 @@ export const validateConfig = (
validatedConfig.extras.scopedSlotTextContentFix = !!validatedConfig.extras.scopedSlotTextContentFix;
}

// TODO(STENCIL-1086): remove this option when it's the default behavior
validatedConfig.extras.experimentalScopedSlotChanges = !!validatedConfig.extras.experimentalScopedSlotChanges;

setBooleanConfig(
validatedConfig,
'sourceMap',
Expand Down
7 changes: 7 additions & 0 deletions src/declarations/stencil-private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,13 @@ export interface RenderNode extends HostElement {
* empty "" for shadow, "c" from scoped
*/
['s-en']?: '' | /*shadow*/ 'c' /*scoped*/;

/**
* On a `scoped: true` component
* with `experimentalSlotFixes` flag enabled,
* returns the internal `childNodes` of the scoped element
*/
readonly __childNodes?: NodeListOf<ChildNode>;
}

export type LazyBundlesRuntimeData = LazyBundleRuntimeData[];
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/bootstrap-custom-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export const proxyCustomElement = (Cstr: any, compactMeta: d.ComponentRuntimeMet
if (BUILD.scoped && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) {
// This check is intentionally not combined with the surrounding `experimentalSlotFixes` check
// since, moving forward, we only want to patch the pseudo shadow DOM when the component is scoped
patchPseudoShadowDom(Cstr.prototype, cmpMeta);
patchPseudoShadowDom(Cstr.prototype);
}
} else {
if (BUILD.slotChildNodesFix) {
patchChildSlotNodes(Cstr.prototype, cmpMeta);
patchChildSlotNodes(Cstr.prototype);
}
if (BUILD.cloneNodeFix) {
patchCloneNode(Cstr.prototype);
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/bootstrap-lazy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ export const bootstrapLazy = (lazyBundles: d.LazyBundlesRuntimeData, options: d.
// This check is intentionally not combined with the surrounding `experimentalSlotFixes` check
// since, moving forward, we only want to patch the pseudo shadow DOM when the component is scoped
if (BUILD.scoped && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) {
patchPseudoShadowDom(HostElement.prototype, cmpMeta);
patchPseudoShadowDom(HostElement.prototype);
}
} else {
if (BUILD.slotChildNodesFix) {
patchChildSlotNodes(HostElement.prototype, cmpMeta);
patchChildSlotNodes(HostElement.prototype);
}
if (BUILD.cloneNodeFix) {
patchCloneNode(HostElement.prototype);
Expand Down
Loading