Two bugs, both visible the moment someone scrolled to the References section
of a translated page.
A stylesheet was being sent to the translator. One Wikipedia reference item
carries a <style> child, and textContent concatenates those: 2,158 characters
of which 2,100 were CSS. The model translated it — no-repeat became 無重複 and
center became 中心, inside a rule set — and the result landed on the page as a
wall of mangled stylesheet.
SKIP_WITHIN could never have caught it. That check uses closest(), which looks
at ancestors, and the stylesheet is a child. Block text now goes through
visibleText(), which walks the tree and skips descendants that are not prose.
innerText would also have worked, but it forces layout and jsdom does not
implement it, which would put this rule beyond the reach of every test. It
also skips this extension's own insertions, so a second run reads the original
text rather than the original plus the first run's output.
Reference lists are no longer translated at all. A bibliography is a lookup
key, not prose; translated, it stops working. The same page turned the
publisher Ollama into 奧拉瑪 and the title "Blog" into "博客", leaving a reader
unable to find either. Sixteen of that article's forty-eight blocks were
references, so skipping them is also a third off the work.
cite is standard HTML; the MediaWiki classes are added because a reference
list is where most readers will meet one. Citations are excluded both by
ancestor and inside visibleText, so a paragraph that merely cites something
has its prose translated and the work's title left findable, while a paragraph
that is nothing but a citation drops out on its own.
Verified live against the loaded extension on the same page: 44 blocks to 28,
no CSS in the output, no translated citations, no mainland vocabulary.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>