Page MenuHomePhabricator

[Task] Prevent events from bubbling up the whole DOM unnecessarily
Closed, InvalidPublic

Event Timeline

Tobi_WMDE_SW raised the priority of this task from to Needs Triage.
Tobi_WMDE_SW triaged this task as Medium priority.
Tobi_WMDE_SW updated the task description. (Show Details)
Tobi_WMDE_SW changed Security from none to None.

Widgets that aggregate other widgets should encapsulate their aggregated widgets' events using event.stopPropagation(). If parent components/widgets are to receive notification, these parent components should rely only on the events of their direct children--anything else implies a logical error. There is no need for events to bubble up any further than their parent component/widget.

Encapsulation is, for example, done in fingerprintview, where the propagation of the events of labelview, descriptionview and aliasesview is stopped. Encapsulation should be a general principle to avoid wasting performance for event bubbling that should not take place anyway.

However, we should not register event handlers just for the purpose of stopping event propagation since filling the event registry has some performance impact as well. Currently, all widgets use jQuery.Widget._trigger() which forwards to jQuery.trigger(). However, in our hierarchical structure, using triggerHandler() should not be just be sufficient but would actually propagate clean separation of the wiget responsibilities as described above.

Jonas renamed this task from Prevent events from bubbling up the whole DOM unnecessarily to [Task] Prevent events from bubbling up the whole DOM unnecessarily .Sep 10 2015, 7:32 PM
Addshore subscribed.

Super old, not much context and probably out of date