Skip to main content
InterviewHubPRO
Section Overview
Q41

Question 41 of 50

Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

82%
HTML5 & Web APIs (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

HTML Web Components: Custom Elements, Shadow DOM, and Templates.

senior LevelComponentsSystem Design

In Simple Words: Web Components are a suite of browser-native technologies for creating reusable custom HTML tags:

  1. Custom Elements (customElements.define): JavaScript API to define custom HTML tags (<user-avatar>).
  2. Shadow DOM (element.attachShadow({ mode: 'open' })): An isolated DOM subtree where CSS styles inside the shadow root do not leak out or get overridden by external styles.
  3. <template> & <slot>: Inert HTML markup cloned dynamically into shadow roots with projection placeholders.