Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is JSHint throwing a "possible strict violation" on this line [duplicate]

Tags:

javascript

Trying to validate some Javascript in JsHint, and I get the following:

Possible strict violation:

return ($.event.dispatch || $.event.handle).apply(this, args);

Any ideas why it's throwing that error?

Thanks guys

like image 972
user1945912 Avatar asked May 14 '13 21:05

user1945912


1 Answers

JSHint isn't sure whether the function that code is in will be called with an actual this.

To tell JSHint how the function will be called and suppress this warning, add /*jshint validthis: true */ to the top of the function.

like image 178
SLaks Avatar answered Dec 01 '22 00:12

SLaks