I'm getting two errors in a JS file, both "Unexpected '--'." It's in code for mousewheel scrolling (both times as this.addEventListener( types[--i], handler, false );
). I've never seen this --i syntax anywhere before. What is it, and how should I correct it to be proper, and make JSLint happier?
(function($) {
var types = ['DOMMouseScroll', 'mousewheel'];
$.event.special.mousewheel = {
setup: function() {
var i;
if ( this.addEventListener ) {
i = types.length;
while ( i >= 0 ) {
this.addEventListener( types[--i], handler, false );
}
} else {
this.onmousewheel = handler;
}
},
teardown: function() {
if ( this.removeEventListener ) {
i = types.length;
while ( i >= 0 ) {
this.removeEventListener( types[--i], handler, false );
}
} else {
this.onmousewheel = null;
}
}
};