<p dir="auto">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 &amp;&amp; target.addEventListener) {...} instead? Are components being removed in an incorrect way that would cause this to happen?</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/**
 * 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 = &quot;click&quot;, 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);
        }
      };
    }
  }"><pre class="notranslate"><code class="notranslate">/**
 * 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);
        }
      };
    }
  }
</code></pre></div>
<p dir="auto">Hello,</p>
<p dir="auto">After updating to React 15.0.1, we are getting the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Uncaught TypeError: Cannot read property 'addEventListener' of null"><pre class="notranslate"><code class="notranslate">Uncaught TypeError: Cannot read property 'addEventListener' of null
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/4996164/14602577/5bb4e9f2-0571-11e6-9aa1-98de49f50d76.png"><img src="https://cloud.githubusercontent.com/assets/4996164/14602577/5bb4e9f2-0571-11e6-9aa1-98de49f50d76.png" alt="image" style="max-width: 100%;"></a></p>