-
Notifications
You must be signed in to change notification settings - Fork 792
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
fix: patchChildSlotNodes
& scopedSlotTextContentFix
not being applied
#6055
Conversation
patchChildSlotNodes
not being applied properlypatchChildSlotNodes
not being applied
patchChildSlotNodes
not being appliedpatchChildSlotNodes
& scopedSlotTextContentFix
not being applied
@christian-bromann any insight into the erroring windows unit test? EDIT |
unfortunately yes, I feel like it may be worth transitioning to Vitest but I haven't had the time to look into that nor find out why it is throwing that error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff 👏
What is the current behavior?
GitHub Issue Number: Fixes #6054
TLDR ...
customElement.childNodes
,customElement.children
monkey-patches are never actually switched-on in Stencil atm.scopedSlotTextContentFix
doesn't fully patch thetextContent
....
Contrary to documentation, the
experimentalSlotFixes
orslotChildNodesFix
flags have no effect on thechildNodes
orchildren
accessors. The patches are only applied if the deprecatedneedsShadowDomShim
flag is fulfilled.This must be a mistake / a hangover from supporting legacy browsers.
Additionally
scopedSlotTextContentFix
alone doesn't fully patch thehost.textContent
accessor. It adds a half-way patch - which I believe to be more confusing than useful.To get the full
textContent
patch users much add bothexperimentalScopedSlotChanges
ANDscopedSlotTextContentFix
(experimentalScopedSlotChanges
alone won't add ANY patch).What is the new behavior?
Adding
experimentalSlotFixes
orslotChildNodesFix
now patcheschildNodes
,children
andchildElementCount
- they only return the nodes / elements that have been slotted - not the items within the component internals. This more closely mimics shadowRoot enabled components.I have removed the
experimentalScopedSlotChanges
for thetextContent
patch.Users need only apply
scopedSlotTextContentFix
or the unifiedexperimentalSlotFixes
.Additionally, I have rolled-in the
experimentalScopedSlotChanges
flag within the unifiedexperimentalSlotFixes
flag - I believe this makes sense asexperimentalScopedSlotChanges
will eventually be 'on' by default.Documentation
Does this introduce a breaking change?
Testing
dom-extras
.text-content-patch
test now only tests for the slotted text and doesn't return internal text)Other information
Making these changes did open a slight a can of worms because the codebase has never actually dealt with
host.childNodes
being monkey patched; everything assumes it will return a full list of component internals...To fix this, using the precedent of
appendChild
(and similar methods) withindom-extras.ts
, I have added a__childNodes
accessor to return a component's 'internal' nodes.