0

AFAIK, programmatic text highlighting on a webpage is achieved by wrapping it in some sort of tag, then attaching some identifier to that tag and styling it. From what I can see in chrome devtools, Ctrl-F doesn't do this, allowing it to be much faster by avoiding the overhead of updating the DOM, it seems?

How is Ctrl-F rendering those highlights specifically?

Xan
  • 74,770
  • 16
  • 179
  • 206
Alex Z
  • 1
  • 5
    It's a built-in feature of the browser so it's implemented internally. – wOxxOm Feb 23 '22 at 22:07
  • 1
    Exactly, Chrome is rendering the DOM so it can render elements however it likes, independent of DOM elements or properties. –  Feb 23 '22 at 22:11
  • You don't need extra DOM elements to highlight whatever. You can highlight a range of text by using range. See https://stackoverflow.com/questions/985272/selecting-text-in-an-element-akin-to-highlighting-with-your-mouse. – code Feb 23 '22 at 22:11

0 Answers0