diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2016-05-02 14:07:26 -0400 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2016-05-11 18:24:23 -0400 |
commit | c41defb7f3813a5f5438534bda4864e46183eb7b (patch) | |
tree | 62adc7021e8fdff9fb034d41247400d1990fffd1 | |
parent | c43066c41ec84ac5e5fe7fb3e6cd3a912a395140 (diff) | |
download | jquery-c41defb7f3813a5f5438534bda4864e46183eb7b.tar.gz jquery-c41defb7f3813a5f5438534bda4864e46183eb7b.zip |
CSS: ensure table styles do not affect reliableHiddenOffsets test
Fixes gh-3065
Close gh-3057
-rw-r--r-- | src/css/support.js | 1 | ||||
-rw-r--r-- | test/data/support/reliableHiddenOffsets.html | 22 | ||||
-rw-r--r-- | test/unit/css.js | 9 |
3 files changed, 32 insertions, 0 deletions
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 = "<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; 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 @@ +<!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> 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( "<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 ); |