Browser internals: DOM, rendering pipeline and critical path – Front End interview prep

261 interview-style multiple-choice questions on Browser internals: DOM, rendering pipeline and critical path, organized by topic: concepts, scenarios, code to read and tradeoffs, each with a short explanation. Learn the 51 key terms with the flashcards first, then test yourself.

Take the practice test · Flashcards · All study tools

What it covers

  1. 9.1 The DOM and DOM APIs
  2. 9.2 Events and event handling
  3. 9.3 The rendering pipeline
  4. 9.4 Loading, parsing and the critical path
  5. 9.5 Storage, cookies and browser caching
  6. 9.6 Networking, origins and fetch
  7. 9.7 Browser architecture and the security model
  8. 9.8 Web platform APIs: observers, history and more
  9. 9.9 DevTools and debugging in the browser

Key terms

9.1 The DOM and DOM APIs

Live collection
DOM list that updates as the document changes
DocumentFragment
Lightweight container for building nodes off-DOM
Custom element
Developer-defined HTML tag
Declarative shadow DOM
Shadow roots created from HTML templates

9.2 Events and event handling

DOM
Document Object Model: the tree of objects representing the page
Event bubbling
An event travelling from the target up through its ancestors
Event delegation
One listener on an ancestor handling events from many descendants
Shadow DOM
Encapsulated DOM subtree with its own scoped styles
Pointer Events
Unified mouse, touch and pen input events
CustomEvent
Script-created event carrying detail data
isTrusted
Flag showing an event came from the user

9.3 The rendering pipeline

Render tree
The visible DOM nodes combined with their computed styles
Layout (reflow)
Computing the size and position of every box
Paint
Filling in pixels for text, colors, borders and images
Compositing
Combining painted layers into the final image, often on the GPU
Style recalculation
Matching CSS rules to elements
Stacking context
Group that z-index compares within
Compositor thread
Thread that combines layers and can scroll
Jank
Visible stutter from slow frames

9.4 Loading, parsing and the critical path

Render-blocking resource
A file that must load before the browser can paint, typically CSS and synchronous scripts
defer
Script attribute: download in parallel, run in order after parsing
async
Script attribute: download in parallel, run as soon as ready
Preload
A hint to fetch a needed resource early at high priority
Preload scanner
Look-ahead parser that starts fetches early
Parser-blocking script
Script that halts HTML parsing until it runs
Speculation Rules
JSON rules to prefetch or prerender pages
Import map
Maps bare module specifiers to URLs

9.5 Storage, cookies and browser caching

Same-origin policy
Browser rule that stops scripts reading data from another origin without permission
Service worker
Background script that can intercept requests for offline support and caching
ETag
Response version identifier used to revalidate cached content
IndexedDB
Browser database for large, structured data with async access
Cache Storage
Script-managed store of request/response pairs
OPFS
Origin Private File System for web apps
Storage partitioning
Third-party storage keyed by top-level site
CHIPS
Partitioned third-party cookies

9.6 Networking, origins and fetch

Origin
Scheme, host and port together
Site
Scheme plus registrable domain
Opaque response
Cross-origin response hidden from script
sendBeacon
Fire-and-forget POST for page exit

9.7 Browser architecture and the security model

Blink
Chromium's rendering engine
Site Isolation
Separate renderer processes per site
JIT compiler
Compiles hot JS to machine code at runtime
Browsing context
Environment showing a document

9.8 Web platform APIs: observers, history and more

Navigation API
Single API for intercepting navigations
Secure context
HTTPS or localhost page
WebAssembly
Binary format running near native speed
Web App Manifest
JSON describing an installable app

9.9 DevTools and debugging in the browser

Conditional breakpoint
Pauses only when an expression is true
Logpoint
Breakpoint that logs without pausing
Heap snapshot
Memory picture with retainer paths
Detached DOM node
Removed node still referenced by JS

Sample practice questions

  1. What is the DOM?

    1. The tree of objects built from HTML that scripts read and change
    2. The CSS rules for each element, merged into one stylesheet
    3. A copy of the page kept on the server for search engines
    4. The raw HTML text exactly as the server sent it over the network

    Answer: A. The tree of objects built from HTML that scripts read and change Changing the DOM changes what is rendered; the source HTML stays the same.

  2. In which order do event phases happen when you click a nested `<button>`?

    1. Only the target phase; events never visit ancestors
    2. Bubbling up to the window first, then capture back down
    3. Capture down to the target, the target, then bubbling back up
    4. Capture and bubbling run at the same time on every ancestor

    Answer: C. Capture down to the target, the target, then bubbling back up Listeners run in the bubbling phase by default; pass `{ capture: true }` to listen while capturing.

  3. In what order does the browser turn HTML and CSS into pixels?

    1. Composite layers first, then build the DOM and paint
    2. Download images, parse CSS, build the DOM, then layout
    3. Paint first, then layout, then parse the HTML and CSS
    4. DOM and CSSOM, render tree, layout, paint, then composite

    Answer: D. DOM and CSSOM, render tree, layout, paint, then composite Each step can be the bottleneck; changes late in the pipeline are cheaper.

  4. What is the difference between `DOMContentLoaded` and `load`?

    1. The first fires after parsing; `load` also waits for images and styles
    2. `DOMContentLoaded` waits for every image to download first
    3. They always fire at the same moment on every page
    4. `load` fires first, before the HTML has been parsed

    Answer: A. The first fires after parsing; `load` also waits for images and styles Most setup code only needs the DOM, so it can run at `DOMContentLoaded`.

  5. What are the main differences between `localStorage` and `sessionStorage`?

    1. `localStorage` persists until cleared; `sessionStorage` lasts for the tab
    2. `localStorage` is sent to the server with every request
    3. `sessionStorage` can store files; `localStorage` can only store text
    4. `sessionStorage` is shared across all tabs; `localStorage` is per tab

    Answer: A. `localStorage` persists until cleared; `sessionStorage` lasts for the tab Both are synchronous and limited to a few MB; use IndexedDB for larger or structured data.

  6. What does the same-origin policy restrict?

    1. Using more than one domain in a single page
    2. Loading any image from another domain into a page
    3. Opening links that point to other websites
    4. Scripts reading data from another origin unless it allows it (CORS)

    Answer: D. Scripts reading data from another origin unless it allows it (CORS) Embedding cross-origin images and scripts is allowed; reading their contents from script is not.

  7. What's a rendering engine?

    1. A GPU driver installed with the browser
    2. The browser's network stack for HTTP requests
    3. The part of a browser that runs JavaScript only
    4. The part of a browser that turns HTML and CSS into pixels

    Answer: D. The part of a browser that turns HTML and CSS into pixels Examples are Blink, WebKit and Gecko.

  8. What is a service worker?

    1. A background script that can intercept requests, enabling offline use
    2. A server-side process that generates and serves the HTML
    3. A web worker whose job is to render the DOM off the main thread
    4. A browser extension API for blocking network requests

    Answer: A. A background script that can intercept requests, enabling offline use It only works over HTTPS (or localhost) and has its own lifecycle.

  9. Which DevTools panel shows the live DOM and its styles?

    1. Application
    2. Elements
    3. Sources
    4. Network

    Answer: B. Elements Firefox calls it the Inspector.

  10. What is the Shadow DOM used for?

    1. Rendering the page in the background before showing it
    2. Storing a hidden copy of the DOM for undo and redo
    3. Speeding up `querySelector` calls on very large pages
    4. Encapsulating a component's DOM and styles from the page

    Answer: D. Encapsulating a component's DOM and styles from the page Web Components use Shadow DOM for style isolation.

Practice all 261 questions

More Front End