Repository navigation
Remove the service:-document registration - #21772
Draft
NullVoxPopuli-ai-agent wants to merge 5 commits into
Draft
NullVoxPopuli-ai-agent wants to merge 5 commits into
NullVoxPopuli-ai-agent wants to merge 5 commits into
Conversation
The VM called the DOM in two ways. Some calls went through `DOMTreeConstruction` and `DOMChanges`. About 100 other calls read or wrote a member of a node directly, for example `node.nextSibling` and `element.setAttribute()`. `DOMRenderer` is one interface with every operation that the VM does on the output tree. `DOMRendererImpl` is its implementation for a browser document and for a SimpleDOM document. All code in `@glimmer/runtime` and `@glimmer/node` now calls the interface, and nodes are only handles there. A different output, for example a terminal, can implement the same interface on its own node objects. The new test does that with plain objects that have no DOM member. Changes to private API: - `Environment#dom` replaces `getDOM()` and `getAppendOperations()`. - `EnvironmentOptions#dom` replaces `appendOperations` and `updateOperations`. - `DOMRendererImpl` replaces `DOMTreeConstruction` and `DOMChanges`. - `NodeDOMRenderer` replaces `NodeDOMTreeConstruction`. - `InternalModifierManager#create` gets the environment as argument 5. The `on` modifier needs it for the listeners. - `normalizeProperty`, `dynamicAttribute`, `clear`, and `move` take the renderer as argument 1. - `sanitizeAttributeValue` takes the tag name, not the element. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`renderComponent` takes `env.dom`, and `BaseRenderer.strict` takes a `DOMRenderer` in place of a document. This gives a renderer that is not the DOM an Ember entry point. The proof test now renders with Ember's `renderComponent` and the run loop, not with the Glimmer render functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 tasks
`EnvironmentImpl`, `runtimeOptions`, `BaseRenderer`, and the classic `Renderer` take a `DOMRenderer`, not a document or an options object. `EnvironmentOptions` is gone. The private `env.document` option of `renderComponent` stays. It is turned into a `DOMRenderer` before the renderer is made. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NullVoxPopuli-ai-agent
force-pushed
the
nvp/private-rendering-adapter
branch
from
October 27, 2026 22:09
6d3cf42 to
480f9a7
Compare
A renderer (`BaseRenderer`, the classic `Renderer`) owns the roots and the render loop. The object that does the output operations is a render adapter, so the names say that: - `DOMRenderer` (interface) → `RenderAdapter` - `DOMRendererImpl` → `DOMRenderAdapter` - `NodeDOMRenderer` → `NodeDOMRenderAdapter` - `env.dom` → `env.adapter`, and the private `renderComponent` option `env.dom` → `env.adapter` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The renderer now gets its render adapter from `getRenderAdapter(owner)`, a WeakMap keyed by owner. The `document` boot option sets the adapter of the application instance, and an engine instance shares the adapter of its parent. An owner with no adapter gets one for the global `document`. `service:-document` was private. Nothing in Ember reads it now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NullVoxPopuli-ai-agent
force-pushed
the
nvp/private-rendering-adapter
branch
from
October 28, 2026 16:17
480f9a7 to
192b7d9
Compare
This branch has not been deployed
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.
Ember no longer registers
service:-document. The renderer gets its render adapter fromgetRenderAdapter(owner).This PR is on top of #21711, which adds the
RenderAdapterinterface. Review only the last commit, "Remove theservice:-documentregistration". After #21711 merges, I will rebase this PR.Why
service:-documentput the document in the container, so any code with an owner could read it. It was private, but addons read it to reach<head>and<body>in FastBoot. That couples them to the renderer's output, and it blocks an output that is not a document, for example a terminal.The renderer must get its output from one private place. That place now holds a
RenderAdapter(#21711), not a document.What changed
packages/@ember/-internals/glimmer/lib/render-adapter.tsis new. It has aWeakMapfrom owner toRenderAdapter, withgetRenderAdapter(owner)andsetRenderAdapter(owner, adapter). An owner with no adapter gets one for the globaldocument.documentboot option sets the adapter of the application instance.Rendererreads the adapter, not the container.renderComponentwith noenv.adapterand noenv.documentuses the adapter of its owner.Breaking for addons that read the private registration
These addons call
owner.lookup('service:-document'), and they getundefinedafter this PR:ef4/ember-head,ef4/ember-set-body-classember-intl,ember-bootstrap,frontile@ember/test-helpers,ember-cli-fastboot, andfastbootdo not read it.Tests
visit_test.js: a visit with adocumentboot option renders with that document. The test checks that the other document created the rendered element. It fails if the boot option does not set the adapter.application_instance_test.js: an engine and its parent share the adapter.Checks
pnpm type-check,pnpm lint:eslint, andpnpm lint:formatpass.pnpm testpasses: 9222 tests, 0 failures, 21 skipped.pnpm builddoes not changepackage.json.🤖 Generated with Claude Code