Repository navigation
Import shadow-tree helpers from shadow-tree.js, and drop shadow.js's re-exports of them - #6366
Conversation
…re-exports of them shadow.js re-exported sixteen helpers shadow-tree.js owns (under, upFrom, renderedUnder, renderedOrder, hostIn, SAID, UI_MARKS and others), so callers were split between two import paths for one owner, and importing through shadow.js pulled registry.js and arrivals.js into modules that need neither. Every import now names shadow-tree.js, and shadow.js keeps only its own exports. No behavior changes.
|
Holding this as a draft: it is a mechanical import move, and merged now it would make two approved PRs conflict that merge cleanly with |
leaf-agent
left a comment
There was a problem hiding this comment.
Three comments still say that helpers this PR moves to shadow-tree.js live in shadow.js. That sends readers to the owner browser/AGENTS.md ("One answer for each question") says not to use:
browser/runtime/passages.js: "andupFrom,under(shadow.js)," in the header that describes how text nodes are walkedbrowser/runtime/passages.js: "UI_MARKSandSAID(shadow.js,uiInside)" above the marker selectorsbrowser/runtime/resolved-target.js: "by the page's rendered order (shadow.js,renderedOrder, or therenderedOrdering…"
pageShadowRoots (shadow.js) and refuseShadowRoot, shadow.js in passages.js are still correct. These lines fall outside the diff, so there are no inline suggestions. Please fix them in the rebase that comes before marking this ready.
…shadow-tree-imports # Conflicts: # browser/runtime/current-target.js # browser/runtime/obligations/view.js
# Conflicts: # browser/runtime/passages.js # browser/runtime/queue-walk.js
|
Ready for review. #6346 and #6337, the two PRs this draft waited on, have both merged. The red |
browser/runtime/shadow.jsre-exported sixteen helpers thatbrowser/runtime/shadow-tree.jsowns (under,upFrom,renderedUnder,renderedOrder,renderedOrdering,byRenderedOrder,hostIn,composedParentNode,renderedParent,shadowHost,excludedByInert,overIn,SAID,UI_MARKS,uiInside,inUi). This PR deletes those re-exports and points every import of them inbrowser/andtests/runtime/atshadow-tree.js, includingwidget-api.js's publicunder. Nowshadow.jskeeps only its own exports.Why:
browser/AGENTS.md("One answer for each question") namesshadow-tree.jsas the owner of these helpers, but callers were split between the two import paths (for example, 23 importedunderthroughshadow.jsand 7 imported it directly). Importing throughshadow.jsalso pulledregistry.jsandarrivals.jsinto modules that need neither. No package importsshadow.js.Verification:
pnpm run checkpasses; it includestest:runtime, 1050/1050 on the head merged with currentmain. Pre-commit passes on the changed files, including eslint, prettier, dependency-cruiser and knip (unused exports and import cycles). A grep finds no import fromshadow.jsthat names a shadow-tree helper. Behavior is unchanged, so no new test.Open PRs #6008, #5981 and #5979 touch some of these files; each overlap is a one-line import change.