Repository navigation
Clear a shadow host's light children in shadowStage - #3885
Merged
Merged
Conversation
Each revision of a diff unloaded any iframe in its line threads in WebKit: the frame stayed connected with a null contentWindow. `show()` cleared the host's light DOM with `this.replaceChildren()` on every rendering, and WebKit's `replaceChildren()` on a shadow host unloads every frame in its shadow tree, even with no child to remove. Removing each child with `remove()` keeps them, as Chromium and Firefox do in every form. The TODO blamed this on lf-diff moving outlets beside redrawn rows. A MutationObserver over the diff's shadow root showed the outlet of a surviving datum keeps its node and parent through a redrawn own line, an added line and a file inserted before it; outlets move only when their datum disappears. So lf-diff leaves that TODO item's list, and the WebKit gap is recorded in notes/browser-support.md. test_a_diff_revision_leaves_a_line_thread_where_it_stands runs in Chromium and WebKit; WebKit fails it with the old clear. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…idget WebKit's replaceChildren() and textContent = "" on a shadow host unload every iframe in its shadow tree. #3852 worked around it in lf-diff alone; lf-file-editor and lf-file-tree still called this.replaceChildren(). shadowStage now removes the host's light children child by child (sparing those a slot takes, which render), so a widget no longer clears its own host and the rule cannot be forgotten. The runtime test for a slotted line break states the assignedSlot happy-dom lacks. The WebKit gap note points at shadowStage. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
An x-shadow widget slots none of its authored children, and a slot that renders after the stage (the documented container pattern) would have lost them anyway, so sparing slotted children was a rule that depended on call order. shadowStage removes them all; module-authoring.md says to read them first. The two passage-boundaries tests that slot content now add it after staging, and one asserts the words exist so the doesNotMatch cannot pass vacuously. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Takes main's TODO.md, whose backlog moved to GitHub issues in #4090. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rebuilds dist/kernel for shadow-stage.js. Co-Authored-By: Claude Opus 5.5 <[email protected]>
max-sixty
marked this pull request as ready for review
October 27, 2026 05:20
Resolves lf-diff.js and notes/browser-support.md against #3852's squashed copy by keeping this branch's side: shadowStage clears the host, so lf-diff's local child-by-child clear goes. Rebuilds dist/kernel from main's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
approved these changes
Oct 27, 2026
This was referenced Oct 27, 2026
leaf-agent
added a commit
that referenced
this pull request
Oct 27, 2026
The keyed slotted-editor fixture appended its input before `shadowStage`, so the host cleanup introduced by #3885 removed it before the test could type. Stage the shadow row first, then append the generated slotted editor, matching the setup order already used by the slot passage tests. This preserves #3885's centralized host cleanup and restores the existing coverage for handing a draft, focus, and backward caret selection to a replacement keyed row. No product behavior or assertions change. Verified `tests/browser/test_render_application_boundary.py::test_keyed_shadow_row_restores_replaced_slotted_editor_and_caret -q -n0`: failed on main at the initial `editor.fill` after 120 seconds; passed with the fixture correction (6.55 seconds). Earlier CI JUnit results show the same test passing in run 40452531123 and failing at that initial fill in run 40459654718; #3885 changed `shadowStage` between those runs. Closes #4384 — automated triage Co-authored-by: leaf-agent <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
shadowStagenow clears the host's light children itself, child by child. Three widgets cleared their own host withreplaceChildren(); in WebKit that unloads every iframe in the host's shadow tree (#3852 fixed onlylf-diff). ThereplaceChildren()calls inlf-diff.js,lf-file-editor.jsandlf-file-tree.jsare gone, along with #3852's local workaround inlf-diff, so a widget has nothing to remember.notes/browser-support.mdnow namesshadowStageas the one place a host is cleared.dist/kernelis rebuilt forshadow-stage.js.Call (reversible): the clear is unconditional (option a). An
x-shadowwidget slots none of its authored children, and sparing slotted ones depended on a slot existing at stage time, which the documented stage-a-container-then-render pattern breaks.skills/leaf/references/module-authoring.md("Shadow stages and styles") now says the stage removes authored children, so a widget reads them first. Every in-tree caller already does: the three widgets above, the runtime's failure box for a staged widget (widget-upgrade.js), and the feature gallery'slf-conversation-workspace, which authors no children.Tests: the two
passage-boundariestests that slot content now add it after staging, and the first asserts the words exist so itsdoesNotMatchis not vacuous.Ran after merging main:
pnpm run check(runtime 668 pass),tests/browser/widgets/test_diffs.py -k line_thread_where_it_stands(Chromium and WebKit), and the file-editor, file-tree and diff-revision selections oftest_render_files.py,test_render_diff_controls.pyandtest_diffs.py. Not run: a WebKit test forlf-file-editororlf-file-treeframes.