Implements event delegation.