DOM Manipulation and Browser APIs Questions
Programming the browser platform: the Document Object Model, traversal and mutation, event handling and the event model, and the wider set of browser and web-platform APIs. Covers manipulating rendered pages and reasoning about browser internals without relying on a framework. A core frontend interview surface.
Implement an asynchronous form validation flow that supports field-level debounced server-side uniqueness checks (e.g., username availability). Provide code sketches for: debouncing requests, cancelling in-flight checks when a new value is entered, updating UI with pending/valid/invalid states, and ensuring accessibility announcements when validation errors appear.
Explain the difference between registering an event handler with an inline attribute (e.g., <button onclick="...">), assigning to element.onclick = fn, and using element.addEventListener('click', fn). Describe the pros and cons of each approach and give an example scenario where addEventListener is clearly preferable.
Design and implement (high-level pseudocode is fine) a virtualized list for rendering tens of thousands of items that supports variable-height rows, infinite scrolling, and recycles DOM nodes to keep memory low. Explain how you would coordinate measuring heights, windowing, and updating scroll offsets to maintain correct scroll position when new data is prepended.
Explain the difference between controlled and uncontrolled form components in React. Provide a short example converting an uncontrolled input (using ref) into a controlled input, and list two advantages of controlled components.
Design a lazy-loading image solution using IntersectionObserver. Describe how you would initialize observers, swap placeholder src with actual src when images enter the viewport, and unobserve images after loading. Include considerations for browsers that lack IntersectionObserver support.
Unlock Full Question Bank
Get access to all 37 DOM Manipulation and Browser APIs interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.