GoogleChromeLabs/link-to-text-fragment

strip whitespace for text, when generating a link

FranklinYu opened this issue · 1 comments

Platform

  • browser: Firefox 100.0b3 (64-bit)
  • OS: macOS 12.2.1
  • hardware: iMac 2019
  • extension version: 2.2.0

Steps to reproduce

  1. Navigate to https://unicode-table.com/en/00BE/
  2. Triple-click the paragraph “Vulgar Fraction Three Quarters. Latin-1 Supplement.” This should select (highlight) the paragraph.
  3. Generate a link with this selection via the context menu.
  4. Open the URL with Firefox. The paragraph is highlighted, as expected.
  5. Open the same URL with Chrome. The paragraph isn’t highlighted.

details

In the generated link, the text value starts with a space, which is probably because the textContent of the <p> itself starts with the space. However, Chrome might trim the space when matching. If I manually remove the %20 in text field, Chrome would be able to highlight the text, as expected. I’m not sure whether this issue counts as a bug or a feature request: it does sound broken, but technically it’s kind of expected (we might as well blame the website).