CSS: fix reliableHiddenOffsets support test for IE6-7

This commit is contained in:
Timmy Willison 2016-01-05 21:29:04 -05:00
parent ce4d7caa17
commit 77f9b1e803
2 changed files with 21 additions and 16 deletions

View File

@ -149,22 +149,27 @@ define( [
div.removeChild( contents ); div.removeChild( contents );
} }
// Support: IE8 // Support: IE6-8
// First check that getClientRects works as expected
// Check if table cells still have offsetWidth/Height when they are set // Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a // to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when // table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using // determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is // display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information). // hidden; don safety goggles and see bug #4512 for more information).
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; div.style.display = "none";
contents = div.getElementsByTagName( "td" ); reliableHiddenOffsetsVal = div.getClientRects().length === 0;
contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0 &&
contents[ 0 ].getClientRects().length === 0;
if ( reliableHiddenOffsetsVal ) { if ( reliableHiddenOffsetsVal ) {
contents[ 0 ].style.display = ""; div.style.display = "";
contents[ 1 ].style.display = "none"; 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;
if ( reliableHiddenOffsetsVal ) {
contents[ 0 ].style.display = "";
contents[ 1 ].style.display = "none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
}
} }
// Teardown // Teardown

View File

@ -283,12 +283,12 @@ testIframeWithCallback(
} else if ( /msie 7\.0/i.test( userAgent ) ) { } else if ( /msie 7\.0/i.test( userAgent ) ) {
expected = { expected = {
"ajax": true, "ajax": true,
"appendChecked": true, "appendChecked": false,
"attributes": false, "attributes": false,
"boxSizing": true, "boxSizing": false,
"boxSizingReliable": false, "boxSizingReliable": false,
"change": false, "change": false,
"checkClone": true, "checkClone": false,
"checkOn": true, "checkOn": true,
"clearCloneStyle": true, "clearCloneStyle": true,
"cors": false, "cors": false,
@ -297,12 +297,12 @@ testIframeWithCallback(
"deleteExpando": false, "deleteExpando": false,
"enctype": true, "enctype": true,
"focusin": true, "focusin": true,
"getSetAttribute": true, "getSetAttribute": false,
"hrefNormalized": true, "hrefNormalized": false,
"html5Clone": false, "html5Clone": false,
"htmlSerialize": false, "htmlSerialize": false,
"inlineBlockNeedsLayout": false, "inlineBlockNeedsLayout": true,
"input": false, "input": true,
"leadingWhitespace": false, "leadingWhitespace": false,
"noCloneChecked": false, "noCloneChecked": false,
"noCloneEvent": false, "noCloneEvent": false,
@ -318,7 +318,7 @@ testIframeWithCallback(
"reliableMarginLeft": false, "reliableMarginLeft": false,
"style": false, "style": false,
"submit": false, "submit": false,
"tbody": true "tbody": false
}; };
} else if ( /msie 6\.0/i.test( userAgent ) ) { } else if ( /msie 6\.0/i.test( userAgent ) ) {
expected = { expected = {