The JavaScript event proxy (event delegate), which is to delegate events that would otherwise be bound to the parent element, so that the parent element acts as an event listener.
As we all know, DOM operations are very performance-intensive. So duplicate event bindings are simply performance killers. And the core idea of the event agent is that by tying as little as possible
To monitor as many events as possible.
The core idea of event broker: Event bubbling
. On (events [, selector] [, data], handler)
. Delegate (selector, EventType, handler)
Starting with jquery 1.7, the On () function provides all the functionality required to bind an event handler to unify the previous event functions such as bind (), delegate (), and Live ().
Example:
<! DOCTYPE html>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
JavaScript event Broker to reduce overhead and increase efficiency