Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#7007 closed bug (duplicate)

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:


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 (356 bytes) - added by ren 13 years ago.

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by ren

Attachment: test.htm added

comment:1 Changed 13 years ago by dmethvin

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.

comment:2 Changed 13 years ago by snover

Cc: snover dmethvin added
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.)

comment:3 Changed 13 years ago by snover

Resolution: duplicate
Status: newclosed

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

Note: See TracTickets for help on using tickets.