Skip to main content

Bug Tracker

Side navigation

#4223 closed bug (wontfix)

Opened February 23, 2009 07:41PM UTC

Closed February 28, 2009 08:28PM UTC

:visible,:hidden doesn't take visibility into account

Reported by: Akzhan Owned by: john
Priority: major Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: :visible, :hidden, visibility Cc:
Blocked by: Blocking:
Description

:visible and :hidden selectors doesn't take CSS visibility attribute into account.

Reported by habr-user Octane.

Sample code:

<html>

<head>

<script src="jquery-1.3.2.js"></script>

<script>

$(function() {

$('#test').css('visibility', 'hidden');

var visible = $('#test').is(':visible'); → true

var hidden = $('#test').is(':hidden'); → false

alert([visible, hidden]);

});

</script>

</head>

<body>

<div id="test">test</div>

</body>

</html>

Attachments (0)
Change History (4)

Changed February 23, 2009 07:46PM UTC by Akzhan comment:1

Additional remark:

visibility CSS style attribute doesn't affect offsetWidth/offsetHeight properties.

Changed February 23, 2009 11:51PM UTC by dmethvin comment:2

It's mostly about what makes sense and how it's documented.

An

opacity:0
has the same net effect as
visibility:hidden
, should that return false as well? What about an element positioned
left: -1000px, top:-1000px
which is out of the view port and thus "invisible"?

Changed February 24, 2009 07:42AM UTC by Akzhan comment:3

Ok, bug can be in wontfix state.

I'll update jQuery wiki.

Changed February 28, 2009 08:28PM UTC by dmethvin comment:4

resolution: → wontfix
status: newclosed