Skip to main content

Practice ยท 1 of 3

Delegation Resolver

Write resolveAction(event, root) for a plain-object event model. event is { target } and elements are objects with matches(sel) and a parent chain ending in null. RETURN the first element from target walking up (including root itself? no โ€” stop before root) that matches("[data-action]"); RETURN null when none matches before reaching root.

Difficulty: intermediate

Back to lesson: Practice: Event Delegation โ€” Practice