CSS: ensure table styles do not affect reliableHiddenOffsets test

Fixes gh-3065
Close gh-3057
This commit is contained in:
Timmy Willison 2016-05-02 14:07:26 -04:00
parent c43066c41e
commit c41defb7f3
3 changed files with 32 additions and 0 deletions

View File

@ -162,6 +162,7 @@ define( [
if ( reliableHiddenOffsetsVal ) {
div.style.display = "";
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
div.childNodes[ 0 ].style.borderCollapse = "separate";
contents = div.getElementsByTagName( "td" );
contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;

View File

@ -0,0 +1,22 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
table {
border-collapse: collapse;
border-style: solid;
}
</style>
</head>
<body>
<div>
<script src="../../jquery.js"></script>
</div>
<script>
jQuery(function() {
window.parent.iframeCallback( jQuery.support.reliableHiddenOffsets() );
});
</script>
</body>
</html>

View File

@ -1105,6 +1105,15 @@ QUnit.test( ":visible/:hidden selectors", function( assert ) {
assert.ok( !jQuery( "<div><div>Test</div></div>" ).find("div").is( ":visible" ), "Disconnected element child is not visible" );
} );
testIframeWithCallback(
"Table styles do not affect reliableHiddenOffsets support test (gh-3065)",
"support/reliableHiddenOffsets.html",
function( testResult, assert ) {
assert.expect( 1 );
assert.equal( testResult, jQuery.support.reliableHiddenOffsets(), "reliableHiddenOffsets value not affected by table styles" );
} );
QUnit.test( "Keep the last style if the new one isn't recognized by the browser (#14836)", function( assert ) {
assert.expect( 2 );