javascript - How expensive is listening for events on the entire document? -
i want use event delegation on number of buttons in page of html. these buttons on page, , wondering how expensive listen entire document on click events, , have on click events trigger event delegation handler. more expensive having listeners on each of 20+ buttons (it can grow on 100 buttons, yes silly)?
i don't see how more expensive since listening clicks on document object instead of 25 anchor objects. said, 25-30 buttons not resource-intensive don't need worry this.
Comments
Post a Comment