Opened 11 years ago
Closed 11 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: |
Description
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)
Change History (4)
Changed 11 years ago by
Attachment: | visible.html added |
---|
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
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 11 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
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.
same issue as #5670, but it lacked an attached test case