You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting this error in the console when certain components are removed from the DOM. It's calling the method below, which assumes that target is not null and tries to access addEventListener of null object. Should it be checking if (target && target.addEventListener) {...} instead? Are components being removed in an incorrect way that would cause this to happen?
/**
* Upstream version of event listener. Does not take into account specific
* nature of platform.
*/
var EventListener = {
/**
* Listen to DOM events during the bubble phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
listen: function (target, eventType, callback) { // target = null, eventType = "click", callback = emptyFunction()
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function () {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback);
return {
remove: function () {
target.detachEvent('on' + eventType, callback);
}
};
}
}
The text was updated successfully, but these errors were encountered:
I'm getting this error in the console when certain components are removed from the DOM. It's calling the method below, which assumes that target is not null and tries to access addEventListener of null object. Should it be checking if (target && target.addEventListener) {...} instead? Are components being removed in an incorrect way that would cause this to happen?
The text was updated successfully, but these errors were encountered: