Reputation: 28503
I need to exclude elements from a function and am struggling with the if-clause...
I can have four type of elements with three attributes
A B C D
-----------------------------------------------------------------
"external" undefined boolean/undefined boolean boolean
"wrapper" boolean undefined boolean undefined
"parent" 1 0 1 1
I need to construct an if-clause that only allows A and B to pass and I'm going insane...
Here is what I have:
// "from" is my element to check
if (
( typeof from.jqmData("external-page") == "undefined"
&& from.parents('body').length == 1 )
||
( typeof from.jqmData("external-page") == "boolean"
&& from.parents('body').length == 0 )
) {
// do something
}
Can someone help me out and get me on the right track?
Thanks!
Upvotes: 0
Views: 267
Reputation: 2375
Will this work:
if (from.parents('body').length === 0 || typeof from.jqmData('external-page') === 'undefined') {
// do something
}
Upvotes: 1