mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
CSS: fix visible/hidden for IE6/7
This commit is contained in:
parent
9e2f55f47c
commit
ecf52b948b
@ -5,14 +5,32 @@ define( [
|
||||
"../css"
|
||||
], function( jQuery, support ) {
|
||||
|
||||
function getDisplay( elem ) {
|
||||
return elem.style && elem.style.display || jQuery.css( elem, "display" );
|
||||
}
|
||||
|
||||
function filterHidden( elem ) {
|
||||
while ( elem && elem.nodeType === 1 ) {
|
||||
if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) {
|
||||
return true;
|
||||
}
|
||||
elem = elem.parentNode;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
jQuery.expr.filters.hidden = function( elem ) {
|
||||
return !jQuery.expr.filters.visible( elem );
|
||||
|
||||
// Support: Opera <= 12.12
|
||||
// Opera reports offsetWidths and offsetHeights less than zero on some elements
|
||||
return support.reliableHiddenOffsets() ?
|
||||
( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 &&
|
||||
!elem.getClientRects().length ) :
|
||||
filterHidden( elem );
|
||||
};
|
||||
|
||||
jQuery.expr.filters.visible = function( elem ) {
|
||||
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ) &&
|
||||
( support.reliableHiddenOffsets() ||
|
||||
( ( elem.style && elem.style.display ) || jQuery.css( elem, "display" ) ) !== "none" );
|
||||
return !jQuery.expr.filters.hidden( elem );
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -159,7 +159,8 @@ define( [
|
||||
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
|
||||
contents = div.getElementsByTagName( "td" );
|
||||
contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
|
||||
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
|
||||
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0 &&
|
||||
contents[ 0 ].getClientRects().length === 0;
|
||||
if ( reliableHiddenOffsetsVal ) {
|
||||
contents[ 0 ].style.display = "";
|
||||
contents[ 1 ].style.display = "none";
|
||||
|
Loading…
Reference in New Issue
Block a user