Premium

Selector Polyfill 2: Implement `closestSimple`

By FrontendAtlas Team · Updated Jan 31, 2026

Implement closestSimple(node, selector) — a DOM-like polyfill for Element.closest() using only parentNode traversal. Why this is common: closest() is used constantly in event delegation and component boundary checks. Node shape (DOM-like, not real DOM): - tagName: string (case-insensitive) - id?: string - className?: string (space-separated…

Challenge preview

Selector Polyfill 2: Implement closestSimple: Implement closestSimple(node, selector) — a DOM-like polyfill for Element.closest() using only parentNode traversal. Why this is common: closest() is used constantly in event delegation…. Expect dom and selectors decisions under intermediate level constraints.

Premium unlocks

  • Full editor workflow with starter files, tests, and solution context.
  • Edge cases, common mistakes, and complexity notes for the interview discussion.
  • Progress tracking once you unlock and complete the challenge.

Free warm-up options

Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.