mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
A couple of small TextHighlighter
/TextLayerBuilder
tweaks (PR 13908 follow-up)
- Use `Node.TEXT_NODE` rather than a magical constant, in `TextHighlighter._convertMatches`, to improve readability. According to MDN, this has been supported since "forever": https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType#browser_compatibility - Remove the `pageIdx`-property, on `TextLayerBuilder`-instances, since the re-factoring in PR 13908 meant that it's now unused. - Remove the `matches`-property, on `TextLayerBuilder`-instances, since the re-factoring in PR 13908 meant that it's now unused.
This commit is contained in:
parent
bb81f4029a
commit
fa4e82c453
2 changed files with 2 additions and 4 deletions
|
@ -167,7 +167,7 @@ class TextHighlighter {
|
|||
|
||||
function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
|
||||
let div = textDivs[divIdx];
|
||||
if (div.nodeType === 3) {
|
||||
if (div.nodeType === Node.TEXT_NODE) {
|
||||
const span = document.createElement("span");
|
||||
div.parentNode.insertBefore(span, div);
|
||||
span.appendChild(div);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue