Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#5342 closed bug (duplicate)

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:


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.

Change History (5)

comment:1 Changed 13 years ago by markw65

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

comment:2 Changed 13 years ago by ElGrande

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.

comment:3 Changed 13 years ago by emartin24

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


comment:4 Changed 13 years ago by emartin24

comment:5 Changed 13 years ago by john

Resolution: duplicate
Status: newclosed

Duplicate of #4512.

Note: See TracTickets for help on using tickets.