mirror of
https://github.com/readest/readest.git
synced 2026-11-30 11:49:50 +00:00
A double tap on a word in a book did nothing in Lite, and the dictionary
behind it could not show a book's own-language Wiktionary entry: Lite
lacked DOM pieces Readest's selection and lookup use.
- document.caretPositionFromPoint / caretRangeFromPoint. Readest finds
the word under a double tap with them (also the reading ruler, instant
highlights and cross-page selections). Blitz maps the point to the
text node and offset (caret_position_from_point, patches/blitz.diff).
- Range cloneContents, extractContents, deleteContents, insertNode and
Text.splitText. Readest reads a selection's text from cloneContents:
makeSelection threw and no popup opened. Word Lens wraps a word with
extractContents and insertNode.
- A DocumentFragment's children have it as their parentNode and each
other as siblings (a walk over a cloned multi-paragraph selection
stopped after its first paragraph), and a fragment has querySelector,
querySelectorAll, children, textContent and append: the vocabulary
couldn't read the word's sentence.
- Element.matches is one native match. It queried the parent, which
recursed for a fragment's child and missed detached elements.
- A node from another document is adopted with its tree, as browsers
do. The Wiktionary lookup moves the section it shows out of a
DOMParser document; it threw WrongDocumentError and fell back to the
English edition.
- before, after and replaceWith, and reflected lang and dir: the lookup
unwraps links with replaceWith and marks its section's language.
Found with a new parity scenario (in a later commit): a double tap on
"Zimmer" in a German book now opens the selection popup in Lite, and
its dictionary shows the German Wiktionary's entry, as Readest does.
What still differs there: Readest raises superscripts with Tailwind's
`position: relative; top: -0.5em`, which Blitz doesn't apply to an
inline element's text.
Tests, each failing without its change:
- caret_position (4 tests): "not a function".
- range: a_ranges_contents_are_cloned_or_moved_into_a_fragment,
delete_contents_removes_what_the_range_selects,
insert_node_splits_the_text_at_the_range_start: "not a function"; the
walk over the clone lost "fo" until fragments linked their children.
- dom_basics: a_fragments_children_link_to_it_and_each_other
("false false false null null"), a_fragment_is_queried_and_read_as_a_
parent_node and nodes_go_before_after_or_in_place_of_a_child: "not a
function".
- parsed_documents: an_element_from_a_parsed_document_is_adopted_with_
its_tree: WrongDocumentError. a_lone_text_node_is_adopted and iframes'
content_document_is_the_iframes_own expected WrongDocumentError for a
page node moved into another document; they now expect the move.
cargo test -p blitz-qjs-script: 110 pass (the long-press test of the
next commit fails here, as it should). -p tauri-runtime-blitz: 89 pass.
Parity, Lite rebuilt: library 12/13, library-book 20/22, reader 20/20,
reader-tools 29/30, novel-turns 13/13, as before. One novel-turns run
gave 11/13 while builds ran alongside: a preloaded section was not
styled yet at step 0; it passed twice after.
Not run: the Kindle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| readest-app | ||
| readest-calibre-plugin | ||
| readest-crosspoint-plugin | ||
| readest-lite | ||
| readest.koplugin | ||