Skip to main content

Bug Tracker

Side navigation

#6859 closed bug (worksforme)

Opened August 02, 2010 07:46PM UTC

Closed August 04, 2010 01:10AM UTC

visible and hidden filters ignore visibility style

Reported by: lathan Owned by:
Priority: Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

If the style visibility: hidden is applied to an element or its parents, it becomes hidden, but the jquery :visible is still true.

Test case included using 1.4.2 on Mozilla 3.6.8 and Chrome 5.0.375.125 both running on Ubuntu Lucid Linux

Attachments (1)
  • visible.html (1.7 KB) - added by lathan August 02, 2010 07:46PM UTC.
Change History (3)

Changed August 02, 2010 07:47PM UTC by lathan comment:1

same issue as #5670, but it lacked an attached test case

Changed August 02, 2010 07:57PM UTC by lathan comment:2

the custom filter I've made to get it to work is:

jQuery.expr.filters.reallyvisible = function(a){
  return !jQuery(a).parents().add(a).filter(function(){
        return ($(this).is(':hidden') ||
               $(this).css('visibility') == 'hidden');})
  .length; }

the current hidden filter checks for width / height being 0 and for css being display: none; but being visibility: hidden doesn't change any of those.

Changed August 04, 2010 01:10AM UTC by dmethvin comment:3

resolution: → worksforme
status: newclosed

As documented, :visible and :hidden only take the css display property into account. They do not consider an element to be visible if it has visibility:hidden, opacity:0, left:-10000px, bottom: 10000px, or other properties that may make it difficult to see the element.