I'm confused with JSLint.
My code originally checked if div:jqmData("me")
was undefined like so:
if ( typeof el.jqmData("me") == "undefined"
? el.not(':jqmData(panel="main")').length > 0
: el.not(':jqmData(me="first")').length > 0 ){
}
JSLint complains that I should replace checking with typeof
with ===
, so I did like this:
if ( el.jqmData("me") === "undefined"
? el.not(':jqmData(panel="main")').length > 0
: el.not(':jqmData(me="first")').length > 0 ){
}
JSLint doesn't complain anymore, but my nested if statement is broken, because I'm now always ending up with the 2nd if el.not(':jqmData(me="first")').length
even when I should not.
Question:
Why does JSLint recommend ===
over typeof == undefined
? How comes this breaks my logic?
Thanks for some enlightment...