Skip to content

Commit c41defb

Browse files
committed
CSS: ensure table styles do not affect reliableHiddenOffsets test
Fixes jquerygh-3065 Close jquerygh-3057
1 parent c43066c commit c41defb

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

src/css/support.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ define( [
162162
if ( reliableHiddenOffsetsVal ) {
163163
div.style.display = "";
164164
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
165+
div.childNodes[ 0 ].style.borderCollapse = "separate";
165166
contents = div.getElementsByTagName( "td" );
166167
contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
167168
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5+
<style>
6+
table {
7+
border-collapse: collapse;
8+
border-style: solid;
9+
}
10+
</style>
11+
</head>
12+
<body>
13+
<div>
14+
<script src="../../jquery.js"></script>
15+
</div>
16+
<script>
17+
jQuery(function() {
18+
window.parent.iframeCallback( jQuery.support.reliableHiddenOffsets() );
19+
});
20+
</script>
21+
</body>
22+
</html>

test/unit/css.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,15 @@ QUnit.test( ":visible/:hidden selectors", function( assert ) {
11051105
assert.ok( !jQuery( "<div><div>Test</div></div>" ).find("div").is( ":visible" ), "Disconnected element child is not visible" );
11061106
} );
11071107

1108+
testIframeWithCallback(
1109+
"Table styles do not affect reliableHiddenOffsets support test (gh-3065)",
1110+
"support/reliableHiddenOffsets.html",
1111+
function( testResult, assert ) {
1112+
assert.expect( 1 );
1113+
1114+
assert.equal( testResult, jQuery.support.reliableHiddenOffsets(), "reliableHiddenOffsets value not affected by table styles" );
1115+
} );
1116+
11081117
QUnit.test( "Keep the last style if the new one isn't recognized by the browser (#14836)", function( assert ) {
11091118
assert.expect( 2 );
11101119

0 commit comments

Comments
 (0)