diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2016-01-05 21:29:04 -0500 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2016-01-06 14:05:18 -0500 |
commit | 77f9b1e8037b1e4dc12e64cf10240f4b97383c30 (patch) | |
tree | 752f539d81888992ce4fcd50db302f13a44dbb34 /src/css | |
parent | ce4d7caa1703ab45c51c0e00efd3e298833744b9 (diff) | |
download | jquery-77f9b1e8037b1e4dc12e64cf10240f4b97383c30.tar.gz jquery-77f9b1e8037b1e4dc12e64cf10240f4b97383c30.zip |
CSS: fix reliableHiddenOffsets support test for IE6-7
Diffstat (limited to 'src/css')
-rw-r--r-- | src/css/support.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/css/support.js b/src/css/support.js index 6ff4cb19f..fbefc7b33 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -149,22 +149,27 @@ define( [ 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 // 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 // determining if an element has been hidden directly using // 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). - 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 && - contents[ 0 ].getClientRects().length === 0; + div.style.display = "none"; + reliableHiddenOffsetsVal = div.getClientRects().length === 0; if ( reliableHiddenOffsetsVal ) { - contents[ 0 ].style.display = ""; - contents[ 1 ].style.display = "none"; + div.style.display = ""; + 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; + if ( reliableHiddenOffsetsVal ) { + contents[ 0 ].style.display = ""; + contents[ 1 ].style.display = "none"; + reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; + } } // Teardown |