in web/index.js [116:132]
async function anchor(selector) {
const matchAll = createMatcher(selector);
const ranges = [];
// First collect all matches, and only then highlight them; to avoid
// modifying the DOM while the matcher is running.
for await (const range of matchAll(target)) {
ranges.push(range);
}
for (const range of ranges) {
const removeHighlight = highlightText(range);
moduleState.cleanupFunctions.push(removeHighlight);
}
info.innerText += JSON.stringify(selector, null, 2) + '\n\n';
}