Skip to content

fix(browser): keep the spaces of words built one element per letter - #105

Merged
httpsphl merged 2 commits into
mainfrom
fix/reader-spaces
Oct 2, 2026
Merged

httpsphl merged 2 commits into
mainfrom
fix/reader-spaces

Conversation

@httpsphl

@httpsphl httpsphl commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Found while doing the real Claude Code checks owed by #62: a bot read example.com's text with no spaces between words ("Thisdomainisforuse…"), and said so itself.

  • Cause: example.com's script now wraps each letter of its English, French, Russian and Spanish text in its own <span>, spaces included (<span> </span>). The page reader (reader.js) dropped text nodes made of spaces alone, so the words ran together. The Arabic text was fine, because the script keeps the space with each word there.
  • Fix: a text node of spaces alone is one space now. The reader already collapses spaces in a row and the spaces around line breaks, so nothing else changes.
  • Test: a test page with one span per letter. The new real-Edge test words_made_of_one_element_per_letter_keep_their_spaces fails on main ("Twowords") and passes here. The browser test files passed three times in a row on Windows.
  • Spec: 21.6 updated.

The page reader dropped text nodes made of spaces alone. example.com's
script now puts each letter of its English text in its own span, spaces
included, so the bot read "Thisdomainisforuse...". A text node of
spaces is one space now; spaces in a row still collapse.
@httpsphl
httpsphl merged commit ef4ce38 into main Oct 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant