Skip to main content

Bug Tracker

Side navigation

#5342 closed bug (duplicate)

Opened October 08, 2009 10:44PM UTC

Closed November 11, 2009 10:35PM UTC

Last modified March 15, 2012 11:59AM UTC

hidden/visible broken for td/th cells in ie8

Reported by: markw65 Owned by: john
Priority: major Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

In ie8, a td or th cell with style "display:none" appears to inherit the size of its parent tr. ie offsetWidth and offsetHeight return the width/height of the tr.

The result is that :hidden and :visible are broken for such cells.

Attachments (0)
Change History (5)

Changed October 09, 2009 02:20PM UTC by markw65 comment:1

I have an example at http://maps.myosotissp.com/bugs/sort2.html.

The example is really to show how the same ie8 feature breaks sortable - but it reports the number of not(:hidden) td cells. In all browsers except ie8, it reports "nvis=6" (correct). In ie8, it reports "nvis=8".

There is a workaround. Adding "<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />" causes ie8 to report the correct result.

You can see this at http://maps.myosotissp.com/bugs/sort2.html?ie7=1

Changed October 30, 2009 04:49PM UTC by ElGrande comment:2

We had a similar issue with visible filters like this:

find('> thead > tr:first > th:visible')

IE8 returned all elements including the elements with

display:none

Our quick fix for this one:

In the file

jquery.js
you can find the visible filter code:

Sizzle.selectors.filters.visible = function(elem){
	return elem.offsetWidth > 0 || elem.offsetHeight > 0;
};

Add an additional condition to verify the display value.

Sizzle.selectors.filters.visible = function(elem){
	return (elem.offsetWidth > 0 || elem.offsetHeight > 0) && elem.style.display != 'none';
};

I guess there are more lines of code left to fix all issues. Reason for this is that IE8 stores width values for elements not visible.

Changed October 30, 2009 08:10PM UTC by emartin24 comment:3

Just ran across this issue as well. Here is my little test case - it works in all browsers that I've tested, except IE8:

http://jsbin.com/omoce/edit

Changed October 30, 2009 10:51PM UTC by emartin24 comment:4

Changed November 11, 2009 10:35PM UTC by john comment:5

resolution: → duplicate
status: newclosed

Duplicate of #4512.