:hidden selector

:hidden selector

Hi guys, just came across an issue when using $('img').is(':hidden') - it returns true if its the first time I am loading a page with an image. Because it wasn't cached yet.
But in documentation it is saying that

Elements can be considered hidden for several reasons:

  • They have a CSS display value of none.
  • They are form elements with type="hidden".
  • Their width and height are explicitly set to 0.
  • An ancestor element is hidden, so the element is not shown on the page.
the image does not satisfy any of those conditions. I highlighted the 3rd one because I don't believe that this is what really is happening in the jquery code.
Here is the function responsible for that:
return (elem.offsetWidth === 0 && elem.offsetHeight === 0) || 
(!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS(elem, "display")) === "none");

as we can see it doesn't check if width and height are explicitly set to 0 like it's stated in the documentation. which is rather confusing.

I don't know if it's a bug in the functionality or just the documentation should be more clear about that.