DOM Manipulation and Browser APIs Questions

Programming the browser platform directly, without a framework: the Document Object Model, node selection and traversal (live vs static collections), content and attribute mutation (innerHTML vs textContent, attributes vs properties, DocumentFragment, cloning), the event model (capture, target, bubble, delegation, preventDefault vs stopPropagation, passive and once listeners, custom events, pointer, touch and keyboard events, drag and drop), and web-platform APIs (IntersectionObserver, MutationObserver, requestAnimationFrame and requestIdleCallback, Web Storage and IndexedDB and choosing between them, postMessage, BroadcastChannel and cross-tab coordination, fetch error handling with AbortController, Shadow DOM and Web Components). Includes keyboard and screen-reader operable vanilla widgets (modals, dropdowns, accordions, date pickers, carousels, data grids) with focus management and route-change focus, the DOM-level mechanics of reflow and layout thrash, listener and detached-node memory leaks, and writing vanilla JavaScript to build interactive widgets. Ground covered elsewhere: the event loop and promise mechanics, profiling-driven page speed work, form-validation and component-state patterns, application-level security, and rebuilding standard APIs from scratch.

MediumTechnical
105 practiced

A page must render a list of 500 strings into a ul without janking. Write the function and explain what makes your approach cheaper than appending one node at a time or rewriting innerHTML repeatedly.

EasyTechnical
81 practiced

A search box handles typing with input, change, and several keyboard events in different places and behaves inconsistently. Explain how those events differ, when each fires, and what to watch for when handling high-frequency ones.

HardSystem Design
107 practiced

Users submit actions while offline, such as form submissions and interaction events, and these must reach the server later without loss, duplication, or reordering. Design the client-side queue: where it lives, how it survives reloads, and how it retries.

EasyTechnical
94 practiced

Given the following HTML:

<ul id="menu"> <li class="item" data-id="1">Home</li> <li class="item" data-id="2">About</li> <li class="item" data-id="3">Contact</li> </ul>

Write three JavaScript statements that: (1) select the <ul> by id, (2) select all <li> elements as a NodeList, and (3) select the second <li> using a CSS selector. After the code, briefly explain when you would prefer querySelector/querySelectorAll over getElementById/getElementsByClassName in real code.

EasyTechnical
76 practiced

Write a small browser helper that loads the user list from GET /api/users and returns the parsed data. Callers need to tell a server error response apart from the network being down, with the status where there is one. Walk me through what fetch does and does not treat as a failure.

Unlock Full Question Bank

Get access to all 30 DOM Manipulation and Browser APIs interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.