Bug Tracker

Opened 13 years ago

Closed 12 years ago

#6859 closed bug (worksforme)

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 13 years ago.

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by lathan

Attachment: visible.html added

comment:1 Changed 13 years ago by lathan

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

comment:2 Changed 13 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 12 years ago by dmethvin

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.

Note: See TracTickets for help on using tickets.