Closed
Description
Hi, I read the documentation for jQuery()
at https://api.jquery.com/jQuery/ but I haven't found the official behavior for passing a single null
or undefined
value (or maybe other falsy values too, like false
, 0
, ''
) to jQuery()
.
Currently null
and undefined
(and other falsies) return an empty set, which is the behavior I would prefer, but I can't know from the docs if I can depend on it.
It's simpler to write $( elementOrNull )
than elementOrNull ? $( elementOrNull ) : $()
or $( elementOrNull || [])
.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels