






















In Internet Explorer (IE) 6, 7 and 8 in 'Compatibility View' there is a bug when hiding content within a hidden container element. The content will remain visible, even though its 'display' property is 'none', as can be observed when the container is re-shown again.
Top left is a container element (red square) containing an image (rabbit in hat). Perform the steps below (Note: order matters!) to see the bug, when viewed in IE6, IE7 or IE8 in 'Compatibility View'.

The bug may be encountered in real life in a situation as shown top right (actually, this was how I ran in to it). There is a set of tabbed pages. Each tabbed page keeps its content in a separate container <div>. If tab 1 is selected, container <div 1> is shown (hence, the other container <div>s are hidden), if tab 2 is selected, container <div 2> is shown, etc.
Initially tab 1 is selected. Hence, tab's 2 container <div> is hidden (display='none'). Now for the problem: inside tab's 2 container <div> happens to be a stack of images. Some of these images should be initially hidden. In this example it's a series of images of a model, supposedly at different ages. Initially, all images but the '10 year old'-one are hidden, so when you switch to Tab 2 for the first time, you should only see the '10 year old' picture.
This is were IE's bug shows up: as container <div 2> was set to display= 'none', the images contained within this <div> were 'immune' for the property 'display= none' imposed on them, and didn't disappear. Hence, all images of the stack will be seen when tab 2 is chosen...
One may 'break the IE spell' by clicking the (+) button seven times. Basically, this resets all the 'immunized' images to 'display= block' (Work-around nr 1 mentioned below). Thereafter, the hiding of the images will work correctly again.
The bug occurs in the following situation:
One may 'release the spell' in a number of ways:
One may also 'overrule' the incorrectly displayed content by:
This issue was first discussed in: http://groups.google.com/group/jquery-en/browse_thread/thread/429f63dcb679da23#.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。