Module: Dommy::Navigation

Defined in:
lib/dommy/navigation.rb

Overview

Navigation host seam. The core fires the intent to navigate (a link activation, a location.assign, a reload, a cross-document history traversal) at a single point — Window#__internal_navigate__ — and the attached delegate decides what actually happens. This keeps real page replacement out of the DOM core (it has no network/session model) while letting an embedder (dommy-rack, a core Browser, dommynx) wire it up.

Same-document navigation (fragment changes / pushState) never reaches a delegate — the core handles it directly via Location/History and fires hashchange/popstate. Only cross-document navigation is delegated.

A delegate is any object responding to:

navigate(url:, method: "GET", body: nil, params: nil, enctype: nil,
       headers: {}, replace: false, source:)
url:     already-resolved absolute URL string
method:  "GET" | "POST" | ...  (GET for links / location / reload)
body:    a pre-serialized request body, or nil
params:  a form submission's ordered [name, value] pair array (as
         produced by Dommy::Interaction::FormSubmission#submit!), left
         unserialized so the delegate can query-encode (GET) or build a
         urlencoded/multipart body (POST) itself; nil for non-form navs
enctype: the form's enctype for `params` (urlencoded / multipart), or nil
headers: extra request headers (Content-Type, ...)
replace: true to replace the current history entry (location.replace,
         a reload, or a redirect)
source:  :link | :form | :location | :reload | :traverse — advisory,
         for diagnostics / policy

traverse(delta)
A cross-document history traversal by `delta` entries. With no bfcache
(a Dommy design decision) this re-fetches the target entry's URL, so an
implementation may reduce it to a `navigate`.

Defined Under Namespace

Classes: Fetcher, JointHistory, NullDelegate, TooManyRedirectsError