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.

HardSystem Design
144 practiced

Design a drag-and-drop list that someone can also operate by keyboard and with a screen reader. How do you handle keyboard reordering, focus, and announcements alongside pointer and touch input?

MediumTechnical
97 practiced

You need to insert a block of markup into a page from a string. Compare building it with createElement and appendChild, insertAdjacentHTML, and assigning innerHTML. What differs in parsing cost, script handling, preserved listeners, and safety, and when would you choose each?

EasyTechnical
90 practiced

What do the capture, once, and passive options of addEventListener change, and where would each earn its keep in a real page?

EasyTechnical
135 practiced

To know when an element enters the viewport you could poll getBoundingClientRect in a throttled scroll handler or use IntersectionObserver. Compare the two on cost, accuracy, and support, and show how you would lazy-load an image with the better one.

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 DOM Manipulation and Browser APIs interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.