This is really a question of how much we should sanity check bad inputs, and what we should do when garbage is passed in. A
null doesn't make sense as an argument to
$.each. Since the first arg should be an object or array, users can just say
$.each(myPossiblyNullVar || [], fn)to avoid the error and make it
clear to readers that the arg could be
null or
undefined. This seems like a benefit, I'd prefer to read that code.
I would prefer that this remains an invalid usage with unspecified behavior, since jQuery itself doesn't need further protection.