Bug 224833

Summary: [GTK] API to list all anchors aka element ids / URL fragment/hash of the current page
Product: WebKit Reporter: Haelwenn (lanodan) Monnier <contact+bugs.webkit.org>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bugs-noreply
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   

Description Haelwenn (lanodan) Monnier 2021-04-20 14:53:47 PDT
URL fragments: Anchors defined with the `id` (and formerly `name`) attribute in HTML, visible via `location.hash` in JavaScript.

This is possible to do right now via executing code in JavaScriptCore on page loads but it would probably be more efficient* to have a proper API endpoint to list the available fragments.

A use case for this would be to list fragments either in a menu or when completing the URL.

*: document.anchors seems to be only for the `name` attribute and I haven't found a better solution than going through each node and checking if they have an `id` attribute