From resource to document tree
HTML parsing tokenizes input and constructs a document tree for display and scripting. Defined error handling means a browser displaying a page does not prove that its source markup was conforming.
Documents can request images, styles and scripts. Resource arrival, parsing and script-driven changes can interleave, so receiving HTML does not mark one universal completion point for every page task.
Structure and visual layout
Styling organizes document content into layout boxes. Viewports, containing blocks, line wrapping and positioning determine the presentation, allowing one document to adapt to different screens.
A page is therefore not a fixed image sent by a server. Document structure, fonts and sizing constraints influence reading, and later changes can require further layout or display work.
Scheduling and document boundaries
Event loops coordinate parsing, callbacks and resource processing. Work occupying an event loop can delay other runnable tasks, so fast transfer alone does not guarantee immediate interaction.
Browsers also enforce boundaries between documents, including restrictions on cross-origin DOM access. Navigating along a link is different from allowing the original page’s script to read the destination document arbitrarily.
For ordinary HTTP and HTTPS documents, same-origin comparison uses scheme, host and normalized port rather than path. https://example.test/a and /b at that same origin do not gain origin isolation merely from different directories; a changed scheme, port or subdomain can create another origin. Same-site comparison is different again, so sharing a registrable domain is not equivalent to sharing an origin. These are script-access boundaries rather than judgments based on appearance or an operator’s name.