diff --git a/src/diff/props.js b/src/diff/props.js index 8d1b5d165d..c65c5783ac 100644 --- a/src/diff/props.js +++ b/src/diff/props.js @@ -150,9 +150,13 @@ export function setProperty(dom, name, value, oldValue, isSvg) { * @private */ function eventProxy(e) { - this._listeners[e.type + false](options.event ? options.event(e) : e); + if (this._listeners && this._listeners[e.type + false]) { + this._listeners[e.type + false](options.event ? options.event(e) : e); + } } function eventProxyCapture(e) { - this._listeners[e.type + true](options.event ? options.event(e) : e); + if (this._listeners && this._listeners[e.type + true]) { + this._listeners[e.type + true](options.event ? options.event(e) : e); + } } diff --git a/test/browser/events.test.js b/test/browser/events.test.js index 2e43cba73a..b893118747 100644 --- a/test/browser/events.test.js +++ b/test/browser/events.test.js @@ -152,6 +152,19 @@ describe('event handling', () => { ); }); + it('should not throw an exception if the listeners array is cleared', () => { + render( +