We’re here! Let’s set up a strategy session!
Let us help you get started on the right path.
1645 E Hwy 193, Suite 103
Layton, UT 84040
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
So I am working on a project where I have to search some HTML documents for a possible text string. This lead me to an interesting find in how browsers do searching on text.
Let’s look at the following HTML.
<div>
<div style="background-color: #00ff00;">Hello ther</div>
<div style="background-color: #ff0000;">e,
<span style="background-color: #f0ff00;">bob</span> how are</div>
<div style="background-color: #00ff00;">you?</div>
</div>
The text displays as the following:
The yellow represents the inner span. The divs are different colors to show their distinction.
If you search for the text “Hello there” no results will be found as the browser does not search across div elements.
If you search for the text “e, bob how are” the text will be found as the browser will search across span elements.
It’s interesting to note that the browser’s search works only across defaulted inline elements but not elements set inline by the html.