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:
Jonas Jenwald 2021-08-25 14:03:25 +02:00
parent bb81f4029a
commit fa4e82c453
2 changed files with 2 additions and 4 deletions

View file

@ -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);