• Robert Knight's avatar
    Only create one highlight element for adjacent text nodes · 2fa1ee4c
    Robert Knight authored
    When highlighting a run of adjacent text nodes, wrap the group of
    adjacent text nodes in a single `<hypothesis-highlight>` element rather
    than wrapping each text node separately. Adjacent text nodes may be
    created if:
    
     - A sub-range of the text is highlighted by Hypothesis, and the
       highlight is later removed, for example when switching groups.
     - The text nodes were generated programatically by JavaScript rather
       than by the browser's HTML parser
    
    For screen reader users, this reduces the number of "annotation
    start"/"annotation end" comments they will hear in this scenario. It is
    also likely to benefit other code which interacts with highlighted text.
    2fa1ee4c
highlighter-test.js 5.02 KB