Skip to main content

Bug Tracker

Side navigation

#11007 closed bug (invalid)

Opened December 13, 2011 09:52AM UTC

Closed December 14, 2011 03:33PM UTC

:visible attribute works differently in firefox and IE

Reported by: neveride@gmail.com Owned by: neveride@gmail.com
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.

Attachments (0)
Change History (3)

Changed December 13, 2011 10:43AM UTC by sindresorhus comment:1

owner: → neveride@gmail.com
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.

Changed December 13, 2011 12:02PM UTC by neveride@gmail.com comment:2

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?

Changed December 14, 2011 03:33PM UTC by timmywil comment:3

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/