we (web engine): Experimental web browser project to understand the limits of Claude

Implement window.location Location object #157

open opened by pierrelf.com

Description#

Replace the current window.location stub with a proper Location object per the WHATWG HTML spec. The Location object exposes URL components and provides navigation methods.

Requirements#

Properties (getters)#

  • href — full URL string
  • protocol — scheme + : (e.g., https:)
  • host — hostname + port (e.g., example.com:8080)
  • hostname — hostname only
  • port — port string (empty if default)
  • pathname — path (e.g., /page)
  • search — query string including ?
  • hash — fragment including #
  • origin — scheme + host (read-only)

Setters#

  • Setting href navigates to the new URL
  • Setting pathname, search, hash, etc. navigates to the modified URL
  • Setting hash alone should trigger fragment navigation (no page reload)

Methods#

  • assign(url) — navigate to URL (adds history entry)
  • replace(url) — navigate to URL (replaces current history entry)
  • reload() — reload the current page
  • toString() — returns href

Acceptance Criteria#

  • All Location properties return correct URL components for the current page
  • Setting location.href = '...' navigates to the new URL
  • location.assign() navigates and adds a history entry
  • location.replace() navigates without adding a history entry
  • location.reload() re-fetches and re-renders the current page
  • document.location is the same object as window.location
  • Unit tests for all property getters and navigation methods
sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:meotu43t6usg4qdwzenk4s2t/sh.tangled.repo.issue/3mii3nkv4x727