feat(hackbrowser): declarative nav harvest (Yön A of #120) - #124
Merged
Conversation
collectDOMLinks normalized hrefs inline (origin+pathname+search+hash) and scoped by hostname, diverging from the rest of the crawl which uses resolveUrl (resolve-against-page + isInScope + normalizeUrl). Route the harvested hrefs through resolveUrl instead: bare "#section" scroll anchors now collapse to the base page (no phantom targets) while "#/route" hash-router URLs are preserved, and dedup matches the BFS queue's keys. Prep for harvesting declarative nav attributes (relative/hash values that must resolve against the page URL). Refs #120
Button/router-nav SPAs often expose no <a href> links, so the DOM-link supplement found nothing and route discovery fell entirely on the planner's per-page clicks — shallow crawls (#120). Widen the harvest to elements that declare a destination without an anchor: data-href, data-url, and role=link. The first destination attribute per element is resolved against the page URL (so relative and #/hash-route values work) and scoped/deduped as before. routerLink/[to]/data-route are excluded on purpose — their values are router-relative and would need scheme-guessing; those routes are discovered imperatively by clicking (phase B). Refs #120
The harvest is no longer <a href>-only (it now covers data-href/data-url/ role=link), so the DOM-specific name is misleading. Rename to collectNavLinks across the definition, call sites, and comments. Refs #120
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the DOM-link harvest beyond
<a href>to declarative nav attributes (data-href/data-url/role=link[href]) and routes all harvested targets through resolveUrl for consistent scope/normalization (drops phantom scroll-anchor targets). Verified on canary.7 — no regression (classic-app crawl depth unchanged, no crashes). Part of #120; the imperative/button-nav sweep (nav discovery engine) is the remaining, larger part.