Repository navigation
Render Gemini streaming responses without replacing source DOM - #1
Merged
Merged
Conversation
kangjoseph90
marked this pull request as ready for review
October 12, 2026 08:19
kangjoseph90
added a commit
that referenced
this pull request
Oct 12, 2026
Render Gemini streaming responses without replacing source DOM
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.
Streaming currently skips parser fixes because replacing a Gemini paragraph's innerHTML removes the Text nodes its renderer owns. Removing that guard can leave stale output or append cumulative text next to the parsed prefix. Initial-disabled sessions also miss later toggle messages.
Render each supported text block in an extension-owned shadow tree while keeping its light-DOM children intact. A clipped original slot preserves native text readers; disabling switches to a plain slot, cancels queued work and restores native display. Re-enabling reads the current source, including updates made while disabled. Streaming and completed responses now share one renderer.
Validation: all 58 browser tests pass, including retained source identity, 500 cumulative updates, sustained streaming, 30 rapid toggles, feature/color reset, response/SPA replacement, native button handlers, layout, selection/accessibility, font loading and Trusted Types. Completion regressions verify first-frame mounting, retained inline/formula identity, and identical streaming/final fonts. Audit regressions cover Korean quoted emphasis, code backslashes/whitespace, literal entities, bracket math, nested underline with opaque content, prices, metadata-split tokens, hidden native text/math, and nested ancestor themes. An actual installed MV3 extension also passes popup/storage and initially-disabled cross-tab tests on an intercepted gemini.google.com fixture. Public-registry npm ci, generated-userscript consistency and git diff checks pass. CI runs the same suite.
Live Gemini DOM and the installed inline-code presentation were inspected. Native response-copy, virtualization, and auto-scroll remain only partially verified; automated tests do not submit prompts to live Gemini.