Bug Tracker

Modify

Ticket #5342 (closed bug: duplicate)

Opened 4 years ago

Last modified 15 months ago

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:
Blocking: Blocked by:

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.

Change History

comment:1 Changed 4 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 4 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 4 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:

 http://jsbin.com/omoce/edit

comment:4 Changed 4 years ago by emartin24

comment:5 Changed 4 years ago by john

  • Status changed from new to closed
  • Resolution set to duplicate

Duplicate of #4512.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.