Given HTML source code as a string, is it possible to find the start and end column + line number that a tag appears on given a CSS selector for that tag? For example, given this string:
<h1>test</h1><h1 class="cls">
<p>1234</p>456</h1><p>789
I want to know the start and end positions of the tag that matches the selector "h1.cls".
I know I can use https://developer.mozilla.org/en-US/docs/Web/API/DOMParser to parse the string into HTML and fetch tags with selectors but I can't see any way to get the line numbers the tags would be on e.g.:
const doc = new DOMParser().parseFromString(input, "text/html");