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
95 practiced

Implement, in vanilla JavaScript, an event delegation handler attached to a container with id 'list' that handles clicks on child elements bearing a data-action attribute. The handler should dispatch to different functions based on data-action, support elements added dynamically, avoid expensive DOM queries on each click, and correctly handle events originating from nested child nodes.

HardTechnical
81 practiced

A click listener on a web component's host element reports the host, not the inner button that was clicked. Explain why, whether a listener outside the shadow root can ever see the real origin, and what that means for delegation across component boundaries.

MediumTechnical
83 practiced

You add a passive touch or wheel listener and then call preventDefault inside it. What happens, why does the browser behave that way, and how do you safely detect support for the options object?

MediumTechnical
72 practiced

Design a lazy-loading image system for a long gallery that also loads more items as the user nears the bottom. Cover how images are observed, what happens once one loads, what you do for browsers without the underlying API, and how you avoid duplicate or runaway loads.

EasyTechnical
93 practiced

Walk through the ways to select elements in the DOM and what each returns. Which results are live and which are static, and how could that difference bite you in a loop?

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.