Description#
Clicking an <a href="..."> element should navigate the browser to the target URL. This is the most fundamental navigation feature — without it, the browser is a single-page viewer.
Requirements#
- Hit-test mouse clicks against
<a>elements in the render tree - Extract the
hrefattribute from the clicked anchor element - Resolve relative URLs against the document's base URL (using the
urlcrate) - Initiate a new page load via the ResourceLoader
- Replace the current document in the browsing context with the newly loaded page
- Re-run style resolution, layout, and paint for the new document
- Handle
targetattribute basics:_self(default),_blank(ignore for now) - Support
<a>elements wrapping block-level content (not just inline text) - Handle
<area>elements inside<map>(stretch goal)
Acceptance Criteria#
- Clicking a link on a rendered HTML page loads and displays the linked page
- Relative URLs (e.g.,
href="/about") resolve correctly against the current page URL - Absolute URLs (e.g.,
href="https://example.com") work - Protocol-relative URLs (e.g.,
href="//example.com/page") work - Links with
href=""reload the current page - Links with
javascript:href are ignored (no crash) - Unit tests for URL resolution and click-to-navigate flow