Skip to main content

Bug Tracker

Side navigation

#7007 closed bug (duplicate)

Opened September 06, 2010 03:47PM UTC

Closed October 05, 2010 08:05AM UTC

Last modified March 15, 2012 01:27PM UTC

Row in hidden table is(':visible')

Reported by: ren Owned by:
Priority: undecided Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: tr visible hidden Cc: snover, dmethvin
Blocked by: Blocking:
Description

I have a table with style attribute "display:none".

When i select row and call $(rowSelector).is("visible") it unexpectedly returns true in all major browsers.

Sample attached.

I've debugged jQuery and i have found out that jQuery.expr.filters.hidden function skips width and height checking for tr elements. When I removed this flag from code it began to work properly. Probably bug in this function.

Attachments (1)
  • test.htm (0.3 KB) - added by ren September 06, 2010 03:49PM UTC.
Change History (3)

Changed September 08, 2010 12:48AM UTC by dmethvin comment:1

Some thoughts on this:

Originally, the

:visible
and
:hidden
selectors only considered whether the element was
display:none
so that an element might be considered visible even if a parent was hidden. However, we determined that
offsetHeight
and
offsetWidth
were 0 on hidden elements, which allowed a quick and ideal way to determine visibility.

Unfortunately, there are some bugs in IE that falsely report a height and width for hidden table elements. That's the code you're seeing. Since the table is hidden but not the TBODY/TR below, it gets the wrong answer. To get a consistent result, it seems like we'd need init code to detect IE's false-height TR and then when asked if a TD/TR is visible for that case, crawl up the tree to see if any parent is hidden.

Changed October 05, 2010 12:09AM UTC by snover comment:2

cc: → snover, dmethvin
priority: → undecided

dmethvin, are you working on this? I’ve discovered that a large part of the effects testing code was wrong (element visibilities were being tested on children within parents with display: none), so this is actually breaking show(Number) on table elements with my new $.fn.animate patch for bug #2185. (It happened to kinda-sorta work before because display:block would be set unconditionally, but that code is gone now because it was wrong.)

Changed October 05, 2010 08:05AM UTC by snover comment:3

resolution: → duplicate
status: newclosed

After stupid amounts of analysis, this is a duplicate of #4512.