title: What causes Kendo to throw a "Cannot read property 'offsetTop' of null" js error?
body: <p>I get the following Kendo js error and stack trace from a page with a Kendo Grid with the error coming in about once or twice a day at random from end users:</p>
  
  <blockquote>
  <pre><code>Message: Cannot read property 'offsetTop' of null
  </code></pre>
    
    <p>at offsetTop line 28097, column 35 (/source//kendo.all.js:28097)</p>
  
  <pre><code>    var itemHeight = $(element.children[0]).height();
      var itemIndex = Math.floor(scrollTop / itemHeight) || 0;
      var item = element.children[itemIndex] || element.lastChild;
      var forward = item.offsetTop &lt; scrollTop;
      while (item) {
          if (forward) {
              if (item.offsetTop + itemHeight &gt; scrollTop || !item.nextSibling) {
  </code></pre>
    
    <p>at _firstVisibleItem line 28127, column 39
    (/source//kendo.all.js:28127)</p>
  
  <pre><code>    if (!template) {
          return;
      }
      var visibleItem = this._firstVisibleItem();
      if (visibleItem) {
          this.header.html(template(visibleItem.group));
      }
  </code></pre>
    
    <p>at _renderHeader line 27650, column 29 (/source//kendo.all.js:27650)</p>
  
  <pre><code>            var that = this;
              clearTimeout(that._scrollId);
              that._scrollId = setTimeout(function () {
                  that._renderHeader();
              }, 50);
          }, this);
      },
  </code></pre>
  </blockquote>
  
  <p>It's not clear if the error is having any impact, but any error is disturbing and takes up room in our error log. My best guess is that the error occurs while the user is navigating away from the page. Perhaps there is a way to dispose of the grid safely without issue, though the problem could be something else entirely.</p>
  
  <p>I'm using the latest Kendo release from January 2017, but I've seen it on previous versions as well.</p>
  
  <p>Is there anything that can be done to eliminate this error, or can it be safely ignored?</p>