What is the advantage of the event-delegation model over the earlier event inheritance model? Event-delegation model has two advantages over event-inheritance model.
- It enables event handling by handling the objects other than ones which were generated by the events or their containers. It clearly separates component design and its usage.
- It performs much better in applications where more events are generated. It is because of the facts that, this model need not process unhandled events repeatedly, which is the case in event-inheritance model.
- Event-delegation model allows a separation between a component's design and its use as it enables event handling to be handled by objects other than the ones that generate the events.
- As event-delegation model does not have to repeatedly process unhandled events, it performs much better in applications where many events are generated. This is unlike the event inheritance model.