A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Standardize, and improve, window.find or a new alternative

bahrus
2022-11-26

With the attention being brought to searching for text recently, due to the introduction of hidden=until found and similar functionality for the detail element, I wonder if it is a good time to dust off the window.find function, and standardize it, or come up with a new function all the browser vendors can agree to?

I would want window.find to support searching for text within a specified (Shadowed) DOM element as well.

bahrus
2022-11-27

Apparently there’s some hope: Potentially standardize window.find() · Issue #3539 · whatwg/html (github.com)

bokan
2022-11-28

+1 - we wrote a bunch of find-related spec text for scroll-to-text. That’s still a draft spec but I have it in my queue to start migrating that to WHATWG. I’m not sure I’ll have time to spec find() but I’ll keep this in mind to make it easily generalizable since it seems these should be built on the same primitives. Happy to hear if anyone has thoughts/advice on how best to do that.