Bug Tracker

Opened 10 years ago

Closed 9 years ago

#6231 closed bug (wontfix)

:hidden does not work on tr

Reported by: raimund_meyer Owned by:
Priority: undecided Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

It did work correctly in 1.3.2, but in 1.4.2 it always returns true. I see in the the code that this is intentional, but why? At least a comment in the code would be helpful.

Change History (1)

comment:1 Changed 9 years ago by addyosmani

Priority: undecided
Resolution: wontfix
Status: newclosed

When using either the :hidden (or even the :visible) pseudo-seelctors, jQuery does a test on the actual 'visibility' of the element rather than its CSS visibility or display. What that means is that it checks if the element's physical height and width on the page are greater than 0.

Looking at the jQuery source, as you mentioned, we don't do this with <tr> elements. In this case jQuery checks the CSS display property and only considers the element hidden if its display property is set to none.

Elements which haven't been explicitly added to the DOM are always going to be considered hidden, even if the CSS related to them would allow them to be rendered as visible.

The official documentation (whilst not specifically covering <tr> elements) does include a summary of much of the above and is probably the best place to look for reference related to functions if the code itself hasn't included additional information in comments.

Note: See TracTickets for help on using tickets.