Page 1 of 1

false alarm complaint

PostPosted: Mon Jun 18, 2012 6:42 am
by roedygr
if ( document.URL.indexOf("file:") != 0) document.writeln( "<div class=\"g-plusone\"></div>" );

I get the following error
[JavaScript Lint] lint warning: comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)

indexOf returns an int, no? So what's the problem?

Re: false alarm complaint

PostPosted: Mon Jun 18, 2012 7:52 am
by Albert Wiersch
roedygr wrote:indexOf returns an int, no? So what's the problem?


I think the problem is that JSLint doesn't like your style. :D

I would just change it to "!=="... but you should also be able to disable the message in CSE HTML Validator, though it will still count against JSLint's message counter.

For further discussion, it's probably best to do it on the JSLint forum:
http://tech.groups.yahoo.com/group/jslint_com/

I hope this helps.