false alarm complaint

For technical support for all editions of CSE HTML Validator. Includes bug reports.

false alarm complaint

Postby roedygr » Mon Jun 18, 2012 6:42 am

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?
User avatar
roedygr
Rank V - Professional
Rank V - Professional
 
Posts: 241
Joined: Fri Feb 17, 2006 6:22 am
Location: Victoria BC Canada

Re: false alarm complaint

Postby Albert Wiersch » Mon Jun 18, 2012 7:52 am

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.
Image
Albert Wiersch
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX


Return to CSE Tech Support

Who is online

Users browsing this forum: No registered users and 2 guests