Bug Tracker

Opened 8 years ago

Closed 8 years ago

#11007 closed bug (invalid)

:visible attribute works differently in firefox and IE

Reported by: neveride@… Owned by: neveride@…
Priority: low Milestone: None
Component: selector Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

Hi.

I have a table with <tbody class="className"></tbody> in it. I want to append html to tbody (I use :visible because there are many tables with tbody.className, but others are hidden).

$('.className:visible').append('<tr><td>content</td></tr>');

Now, if there are already rows in tbody, it works in both browsers. If tbody is empty, then IE does not append the row (although the debugger shows that '.className:visible' selector finds an element), firefox does.

Change History (3)

comment:1 Changed 8 years ago by sindresorhus

Owner: set to neveride@…
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

comment:2 Changed 8 years ago by neveride@…

Status: pendingnew

Thanks for the update. I was not aware of the guidelines...

Here is the jsfiddle example: http://jsfiddle.net/GScmY/3/

It works in Firefox, but it does not work in IE (I have IE8.0). Somehow the presence of thead influences the visibility of tbody in firefox, but not in IE. Now when I think of it, it is more of Firefox issue. Can somebody explain what's going on?

comment:3 Changed 8 years ago by timmywil

Component: unfiledselector
Priority: undecidedlow
Resolution: invalid
Status: newclosed

The width and height of tbody is 0 in IE, so it is not considered visible. You can fix this by adding an empty td with a non-breaking space.

http://jsfiddle.net/timmywil/GScmY/7/

Note: See TracTickets for help on using tickets.