Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#4673 closed bug (duplicate)

: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.

Change History (2)

comment:1 Changed 11 years ago by bostanio

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.

comment:2 Changed 11 years ago by dmethvin

Resolution: duplicate
Status: newclosed

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

Note: See TracTickets for help on using tickets.