Imagine that we have next element:
<input type="text" data-search />
<div data-container>
<div>text 1</div>
<div>text 2 <span>some other</span> <strong>text</strong></div>
</div>
After typing on [data-search]
input, typed phrase should be highlighted in container [data-container]
(if phrase has been found).
This search should be "live". Search through elements can be skipped (some other text
doesn't give any results), but if you know how to implement this functionality - it would be great.
So the simple RegExp and replacing all content is quite heavy operation because [data-container]
content can be large.
Other way is drawing rects under the found text. But again, how to detect text position without updating container (we can add some wrapper to the text and calculate its coords and then remove it)?
Probably you can give me a peace of advice in what direction should I move.
Thanks.