1

I have this strange problem: I have a page that works fine on all major browser except IE11, where the page doesn't load.

I checked in the console in ie 11 and found this error:

enter image description here

the error refers to the function SetStyle, that set the style of the scroll bar:

class ScrollBarStyle{
  init(){
    return{
      setStyle: this._setStyle
    }
  }
  _setStyle(node,color,targetClass){
    let self = this;
    let children = Array.from(node.children); // I have set Array.from polifyll for ie11
    if(children){
      children.forEach(function(el){
        if(el.classList.contains(targetClass)){
            el.style.width = '10px';
            el.style.background = color;
            el.style.opacity = '1'
            return
        }
        self.setStyle(el,color,targetClass)
        })      
      }
    }
  }

this is a function I use to set the style of scrollbar in this way:

  _initMainScrollBar(){
    let self = this;
    this.contents.forEach(function(cnt){
      let ps = self.createScrollBar(cnt); //using perfect scrollbar plugin
      let color = self._RetrieveScrollBarColor(cnt)[0]; // get the main color of a section
      self.scrollBarStyle.setStyle(cnt,color,self.targetClass) //set the style
    })
  }

I dont know what's could be the problem, this code works in other browser and I have not found useful information about ie11 and this keyword.

Apparently seems that doing var n=this n results to be undefined,

Honestly I have no clue of what could be the problem.

I'm using babel with gulp:

gulp.task('js',()=>{
  return browserify({
    entries: ['./src/js/main.js'],
    debug:true
   })
  .bundle()
  .pipe(source('bundle.js'))
  .pipe(buffer())
  .pipe(babel({
    presets: ['env'],
    compact: true
  }))
  .pipe(uglify())
  .pipe(gulp.dest('./src/dist/js/'))
  .pipe(browserSync.stream());
});

And also I have inserted the Array.from polyfill for ie11, so I don't think is that the problem

Someone can give me some hints about this problem? maybe is something related to perfect-scrollbar plugin?

Giacomo Ciampoli
  • 821
  • 3
  • 16
  • 33

0 Answers0