Bug Tracker


Ticket #6859 (closed bug: worksforme)

Opened 4 years ago

Last modified 4 years ago

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:
Blocking: Blocked by:


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


visible.html Download (1.7 KB) - added by lathan 4 years ago.

Change History

Changed 4 years ago by lathan

comment:1 Changed 4 years ago by lathan

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

comment:2 Changed 4 years ago by lathan

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.

comment:3 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.