Returning an array of elements hidden state
I would like to return an array of selected elements hidden state.
I ended up using an each method and building the array:
var states = [];
$items.each( function() {
states.push($(this).is(":hidden"));
});
and this works fine, but after spending a good bit of time exploring
and finally use the above, I was curious if there is a more direct
jQuery idiom to obtain the list or array of the current "display'
state of elements?
Basically, I have a set selected items that are are either showing or
not, and at first I tried this:
var states = $items.is(":hidden");
expecting an array of true and false, one for each element.
Instead, it returns a scalar true or false OR mask of all items. It
returns true if any item is hidden, and it returns false iff (if and
only if) all are showing.
Well, I'm not sure if that is proper expected logic in terms of
applying an ".is" on each element of the selector. Even it was
designed to return a scalar, I would of thought that it would do a
AND mask, not a OR mask here. I guess that would be a subjective
design consideration.
Comments?
Thanks
PS: Note, i am not suggesting this is a bug but instead that maybe I
am might be missing an jQuery idea or methoid here that would be
useful in obtaining an array of element properties
--
hls