When you call:
this.menuItems = this.el.querySelectorAll( '.cbp-hsmenu > li' );
the object assigned to menuItems is a static NodeList , which is the host object. Then when you do:
Array.prototype.slice.call( this.menuItems )
you are calling an inline method with a host object like this. In IE 8 and below (and probably many other older browsers) you cannot do this (there is no specification that says you should, although modern browsers allow you).
A simple solution is to convert the menu items into an array using some method other than calling, or add a pad for Array.prototype.forEach and use the CrazyTrain clause:
Array.prototype.forEach.call(this.menuItems, func...)
because in browsers without built-in forEach it will be a native method and works fine. But for reliable code, replace all of this with a simple loop.
source share