Couple edge cases to resolve further for text selections and text fragment URL generation for Share Highlight experiment, that were out of scope for the original cleanup of fragment generation in T417105:
- text matching happens within a single block-level element:
- spec - https://wicg.github.io/scroll-to-text-fragment/#finding-ranges-in-a-document
- thus selections that span two paragraphs will have to have their fragment cut down to the text from the first para or other block element element
- must be handled in useTextSelection.js when dealing with the Selection and Range
- note that if we add prefix/suffix context to disambiguate matches, *those* can come from a separate block element but must each be within a block element
- text matches require that the match start and end on a word boundary
- spec - https://wicg.github.io/scroll-to-text-fragment/#word-boundaries
- have to check the text nodes and adjacent text nodes, so again has to be dealt with in useTextSelection.js
- probably can be approximated with regex check on unicode properties of adjacent text