Design Patterns · Middle · Question 44 of 75
How are event delegation and the Flyweight pattern related?
- ✓Correct answer: One shared handler instead of thousands of identical ones
- 2Delegation creates a copy of the handler on every element
- 3They aren't: delegation is the Singleton pattern
Explanation
A handler on the parent is shared by all child elements, and the unique state (which element) comes from event.target - the Flyweight's extrinsic state. This saves memory and initialization time for large lists.