mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-02-08 00:21:11 +01:00
The current logic assumes that all spans in the text layer contain only one text node, and thus that the position information returned by `highlighter._convertMatches` can be directly used on the element's only child. This is not true in case of highlighted search results: they will be injected in the DOM as `<span>` elements, causing the `<span>`s in the text layer to have more than one child. This patch fixes the problem by properly converting the (span, offset) pair in a (textNode, offset) pair that points to the right text node.