Skip to main content

Bug Tracker

Side navigation

#4673 closed bug (duplicate)

Opened May 19, 2009 11:13PM UTC

Closed May 20, 2009 12:14AM UTC

Last modified March 15, 2012 04:46PM UTC

:visible bug with table rows in IE6 and IE7

Reported by: bostanio Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

The performance improvements introduced to the 'visible' selector in 1.3.2 introduced a bug with table rows in IE6 and IE7. The root cause is likely a buggy implementation of offsetWidth in those browsers. Consider this html test case:

<html>
<head>
	<script type="text/javascript" src="/jquery.js"></script>

	<script type="text/javascript">
		$(document).ready(
		function()
		{
			alert("Rows: " + $("tr").length + ". Visible Rows: " + $("tr").filter(":visible").length);
		});
	</script>
</head>
<body>
	<table cellspacing="0" cellpadding="0">
		<tr>
			<td>
				Test1
			</td>
		</tr>
		<tr style="display: none;">
			<td>
				Test2
			</td>
		</tr>
	</table>
</body>
</html>

You would expect the alert to tell you there are two rows and one visible row.

However IE6 and IE7 consider both rows to be visible. FF3, GC and IE8 give the right answer.

Attachments (0)
Change History (2)

Changed May 19, 2009 11:18PM UTC by bostanio comment:1

Note that jQuery 1.3.1 did not have this problem.

I'm mostly convinced that the problem lies with the IE implementation of offsetWidth in IE. However given that this worked in 1.3.1 it might be on jQuery to have a work around. There may be other situations where IE is equally buggy with similar effects.

Note that there are some subtleties to the IE bug. For example if all the rows of the table are hidden with "display: none" AND the table is styled with "border-collapse: collapse" then the above jQuery alert with zero visible rows. However if there are some visible rows and some hidden rows I've been unable to find any css or html combination that tricks IE into the right calculation of offsetWidth.

Changed May 20, 2009 12:14AM UTC by dmethvin comment:2

resolution: → duplicate
status: newclosed

This is a dup of #4512 and is being discussed actively on the jQuery-dev Google group.