Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb1e66a5

Browse files
authored
CSS: Fix reliableTrDimensions support test for initially hidden iframes
Closesgh-5358Refgh-5317Refgh-5359
1 parentf47c6a8 commitb1e66a5

File tree

4 files changed

+87
-1
lines changed

4 files changed

+87
-1
lines changed

‎src/css/support.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ support.reliableTrDimensions = function() {
4747
.appendChild(tr)
4848
.appendChild(div);
4949

50+
// Don't run until window is visible
51+
if(table.offsetWidth===0){
52+
documentElement.removeChild(table);
53+
return;
54+
}
55+
5056
trStyle=window.getComputedStyle(tr);
5157
reliableTrDimensionsVal=(parseInt(trStyle.height,10)+
5258
parseInt(trStyle.borderTopWidth,10)+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Test computeStyleTests for hidden iframe</title>
5+
<metacharset="utf-8">
6+
<style>
7+
* {
8+
box-sizing: border-box;
9+
}
10+
#test {
11+
position: absolute;
12+
border:10px solid black;
13+
width:400px;
14+
}
15+
#test-table {
16+
position: absolute;
17+
width:100.7px;
18+
border-spacing:0;
19+
}
20+
</style>
21+
</head>
22+
<body>
23+
<divid="test"></div>
24+
<tableid="test-table">
25+
<trid="test-tr"></tr>
26+
</table>
27+
<scriptsrc="../../jquery.js"></script>
28+
<scriptsrc="../iframeTest.js"></script>
29+
<script>
30+
varinitialHeight=$("#test").outerHeight();
31+
startIframeTest(initialHeight);
32+
</script>
33+
</body>
34+
</html>

‎test/data/testinit.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ this.ajaxTest = function( title, expect, options, wrapper ) {
243243
});
244244
};
245245

246-
this.testIframe=function(title,fileName,func,wrapper){
246+
this.testIframe=function(title,fileName,func,wrapper,iframeStyles){
247247
if(!wrapper){
248248
wrapper=QUnit.test;
249249
}
@@ -253,6 +253,11 @@ this.testIframe = function( title, fileName, func, wrapper ) {
253253
.css({position:"absolute",top:"0",left:"-600px",width:"500px"})
254254
.attr({id:"qunit-fixture-iframe",src:url(fileName)});
255255

256+
// Add other iframe styles
257+
if(iframeStyles){
258+
$iframe.css(iframeStyles);
259+
}
260+
256261
// Test iframes are expected to invoke this via startIframeTest (cf. iframeTest.js)
257262
window.iframeCallback=function(){
258263
varargs=Array.prototype.slice.call(arguments);

‎test/unit/css.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,47 @@ testIframe(
13861386
}
13871387
);
13881388

1389+
(function(){
1390+
varsupportsFractionalTrWidth,
1391+
epsilon=0.1,
1392+
table=jQuery("<table><tr></tr></table>"),
1393+
tr=table.find("tr");
1394+
1395+
table
1396+
.appendTo("#qunit-fixture")
1397+
.css({
1398+
width:"100.7px",
1399+
borderSpacing:0
1400+
});
1401+
1402+
supportsFractionalTrWidth=Math.abs(tr.width()-100.7)<epsilon;
1403+
1404+
testIframe(
1405+
"Test computeStyleTests for hidden iframe",
1406+
"css/cssComputeStyleTests.html",
1407+
function(assert,jQuery,window,document,initialHeight){
1408+
assert.expect(3);
1409+
1410+
assert.strictEqual(initialHeight===0 ?20 :initialHeight,20,
1411+
"hidden-frame content sizes should be zero or accurate");
1412+
1413+
window.parent.jQuery("#qunit-fixture-iframe").css({"display":"block"});
1414+
jQuery("#test").width(600);
1415+
assert.strictEqual(jQuery("#test").width(),600,"width should be 600");
1416+
1417+
if(supportsFractionalTrWidth){
1418+
assert.ok(
1419+
Math.abs(jQuery("#test-tr").width()-100.7)<epsilon,
1420+
"tr width should be fractional");
1421+
}else{
1422+
assert.strictEqual(jQuery("#test-tr").width(),101,"tr width as expected");
1423+
}
1424+
},
1425+
undefined,
1426+
{"display":"none"}
1427+
);
1428+
})();
1429+
13891430
QUnit.testUnlessIE("css('width') and css('height') should return fractional values for nodes in the document",function(assert){
13901431
assert.expect(2);
13911432

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp