From c41defb7f3813a5f5438534bda4864e46183eb7b Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Mon, 2 May 2016 14:07:26 -0400 Subject: [PATCH] CSS: ensure table styles do not affect reliableHiddenOffsets test Fixes gh-3065 Close gh-3057 --- src/css/support.js | 1 + test/data/support/reliableHiddenOffsets.html | 22 ++++++++++++++++++++ test/unit/css.js | 9 ++++++++ 3 files changed, 32 insertions(+) create mode 100644 test/data/support/reliableHiddenOffsets.html diff --git a/src/css/support.js b/src/css/support.js index fbefc7b33..6509df2b0 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -162,6 +162,7 @@ define( [ if ( reliableHiddenOffsetsVal ) { div.style.display = ""; div.innerHTML = "
t
"; + 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; diff --git a/test/data/support/reliableHiddenOffsets.html b/test/data/support/reliableHiddenOffsets.html new file mode 100644 index 000000000..b39aaa99d --- /dev/null +++ b/test/data/support/reliableHiddenOffsets.html @@ -0,0 +1,22 @@ + + + + + + + +
+ +
+ + + diff --git a/test/unit/css.js b/test/unit/css.js index 69463e74b..e1cfea19e 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1105,6 +1105,15 @@ QUnit.test( ":visible/:hidden selectors", function( assert ) { assert.ok( !jQuery( "
Test
" ).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 ); -- 2.39.5