Ionic anchorScroll curElm.attributes error

11 views Asked by At

My app has been on Ionic v1 for several years now and I have never seen this error before. As v1 is now archived and no longer supported, I am hoping someone can provide some help here.

For years my app has only listed about 15 to 20 items in an ng-repeat, but recently a client has created a list that is 160 items long...and when that list is viewed in my app I am seeing this error recently. So far, its only been about 5 times, but I would like to fix it before it gets worse.

I have found only one reference to this error, and it that case it was related to collection-repeat and not where mine is coming from, an ng-repeat

I am not using collection-repeat which is highlighted in this issue: https://github.com/ionic-team/ionic-framework/issues/3474

Exception = null is not an object (evaluating 'curElm.attributes')
Stack = @ionic://attendago/lib/ionic/js/ionic.bundle.js:60723:22
[processQueue@ionic://attendago/lib/ionic/js/ionic.bundle.js:29132:30](mailto:processQueue@ionic://attendago/lib/ionic/js/ionic.bundle.js:29132:30)
@ionic://attendago/lib/ionic/js/ionic.bundle.js:29148:39
[completeOutstandingRequest@ionic://attendago/lib/ionic/js/ionic.bundle.js:19199:15](mailto:completeOutstandingRequest@ionic://attendago/lib/ionic/js/ionic.bundle.js:19199:15)
@ionic://attendago/lib/ionic/js/ionic.bundle.js:19475:33

Which traces to this section of code:

  self.anchorScroll = function(shouldAnimate) {
    self.resize().then(function() {
      if (!scrollView) {
        return;
      }
      var hash = $location.hash();
      var elm = hash && $document[0].getElementById(hash);
      if (!(hash && elm)) {
        scrollView.scrollTo(0, 0, !!shouldAnimate);
        return;
      }
      var curElm = elm;
      var scrollLeft = 0, scrollTop = 0;
      do {
        if (curElm !== null) scrollLeft += curElm.offsetLeft;
        if (curElm !== null) scrollTop += curElm.offsetTop;
        curElm = curElm.offsetParent;  
      } while (curElm.attributes != self.element.attributes && curElm.offsetParent);  // ERROR HERE
      scrollView.scrollTo(scrollLeft, scrollTop, !!shouldAnimate);
    });
  };

Any ideas on how to put in a work around or resolve this issue?

0

There are 0 answers