Ensure that all event properties are included, even if no (internal) listeners are registered, when re-dispatching events to the DOM (PR 10019 follow-up)

This commit is contained in:
Jonas Jenwald 2018-09-20 22:43:44 +02:00
parent 0e41eb1620
commit 250e55b0d9

View File

@ -708,12 +708,13 @@ class EventBus {
let eventListeners = this._listeners[eventName]; let eventListeners = this._listeners[eventName];
if (!eventListeners || eventListeners.length === 0) { if (!eventListeners || eventListeners.length === 0) {
if (this._dispatchToDOM) { if (this._dispatchToDOM) {
this._dispatchDOMEvent(eventName); const args = Array.prototype.slice.call(arguments, 1);
this._dispatchDOMEvent(eventName, args);
} }
return; return;
} }
// Passing all arguments after the eventName to the listeners. // Passing all arguments after the eventName to the listeners.
let args = Array.prototype.slice.call(arguments, 1); const args = Array.prototype.slice.call(arguments, 1);
// Making copy of the listeners array in case if it will be modified // Making copy of the listeners array in case if it will be modified
// during dispatch. // during dispatch.
eventListeners.slice(0).forEach(function (listener) { eventListeners.slice(0).forEach(function (listener) {