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

Commit071f6db

Browse files
authored
CSS:Tests: Fix tests & support tests under CSS Zoom
Firefox 126+ implements CSS zoom in a way it affects width computed stylevery slightly (`100.008px` instead of `100px`); accept that difference.Add a test for support tests resolving the same under CSS zoom & without one.That test uncovered Chrome failing the `reliableTrDimensions` support testunder zoom; the test has been fixed.Fixesgh-5489Closesgh-5495Refgh-5496
1 parentf2d9fde commit071f6db

File tree

4 files changed

+43
-5
lines changed

4 files changed

+43
-5
lines changed

‎src/css/support.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ support.reliableTrDimensions = function() {
5454
}
5555

5656
trStyle=window.getComputedStyle(tr);
57-
reliableTrDimensionsVal=(parseInt(trStyle.height,10)+
58-
parseInt(trStyle.borderTopWidth,10)+
59-
parseInt(trStyle.borderBottomWidth,10))===tr.offsetHeight;
57+
reliableTrDimensionsVal=(Math.round(parseFloat(trStyle.height))+
58+
Math.round(parseFloat(trStyle.borderTopWidth))+
59+
Math.round(parseFloat(trStyle.borderBottomWidth)))===tr.offsetHeight;
6060

6161
documentElement.removeChild(table);
6262
}

‎test/data/support/zoom.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<metacharset="utf-8"/>
5+
<style>
6+
html {
7+
zoom:2.1;
8+
}
9+
</style>
10+
</head>
11+
<body>
12+
<div>
13+
<scriptsrc="../../jquery.js"></script>
14+
<scriptsrc="../iframeTest.js"></script>
15+
<scriptsrc="getComputedSupport.js"></script>
16+
</div>
17+
<script>
18+
startIframeTest(
19+
getComputedStyle(document.documentElement),
20+
getComputedSupport(jQuery.support)
21+
);
22+
</script>
23+
</body>
24+
</html>

‎test/unit/css.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,8 +1381,12 @@ testIframe(
13811381
"css/cssWidthBrowserZoom.html",
13821382
function(assert,jQuery,window,document,widthBeforeSet,widthAfterSet){
13831383
assert.expect(2);
1384-
assert.strictEqual(widthBeforeSet,"100px","elem.css('width') works correctly with browser zoom");
1385-
assert.strictEqual(widthAfterSet,"100px","elem.css('width', val) works correctly with browser zoom");
1384+
1385+
// Support: Firefox 126+
1386+
// Newer Firefox implements CSS zoom in a way it affects
1387+
// those values slightly.
1388+
assert.ok(/^100(?:|\.0\d*)px$/.test(widthBeforeSet),"elem.css('width') works correctly with browser zoom");
1389+
assert.ok(/^100(?:|\.0\d*)px$/.test(widthAfterSet),"elem.css('width', val) works correctly with browser zoom");
13861390
}
13871391
);
13881392

‎test/unit/support.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ testIframe(
6666
}
6767
);
6868

69+
testIframe(
70+
"Verify correctness of support tests with CSS zoom on the root element",
71+
"support/zoom.html",
72+
function(assert,jQuery,window,document,htmlStyle,support){
73+
assert.expect(1);
74+
assert.deepEqual(jQuery.extend({},support),computedSupport,
75+
"Same support properties");
76+
}
77+
);
78+
6979
(function(){
7080
varexpected,browserKey,
7181
userAgent=window.navigator.userAgent,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp