3 https://bugzilla.mozilla.org/show_bug.cgi?id=745685
5 <title>Test for Bug
745685</title>
6 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css"/>
8 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=745685">Mozilla Bug
745685</a>
18 /** Test for Bug 745685 **/
20 var referenceSizes
= {};
21 for (var i
= 1; i
<= 7; i
++) {
23 getComputedStyle(document
.querySelector('[size="' + i
+ '"]'))
26 isnot(referenceSizes
[i
], referenceSizes
[i
- 1],
27 "Sanity check: different <font size>s give different .fontSize");
31 function testFontSize(input
, expected
) {
32 var font
= document
.querySelector("font");
33 font
.setAttribute("size", input
);
34 is(font
.getAttribute("size"), input
,
35 "Setting doesn't round-trip (.getAttribute)");
37 "Setting doesn't round-trip (.size)");
38 is(getComputedStyle(font
).fontSize
, referenceSizes
[expected
],
39 'Incorrect size for "' + input
+ '" : expected the same as ' + expected
);
42 function testFontSizes(input
, expected
) {
43 testFontSize(input
, expected
);
45 testFontSize(" " + input
, expected
);
46 testFontSize("\t" + input
, expected
);
47 testFontSize("\n" + input
, expected
);
48 testFontSize("\f" + input
, expected
);
49 testFontSize("\r" + input
, expected
);
51 testFontSize(input
+ "abcd", expected
);
52 testFontSize(input
+ ".5", expected
);
53 testFontSize(input
+ "e2", expected
);
60 testFontSizes("0", 1);
61 testFontSizes("1", 1);
62 testFontSizes("2", 2);
63 testFontSizes("3", 3);
64 testFontSizes("4", 4);
65 testFontSizes("5", 5);
66 testFontSizes("6", 6);
67 testFontSizes("7", 7);
68 testFontSizes("8", 7);
69 testFontSizes("9", 7);
70 testFontSizes("10", 7);
71 testFontSizes("10000000000000000000000", 7);
74 testFontSizes("-0", 3);
75 testFontSizes("-1", 2);
76 testFontSizes("-2", 1);
77 testFontSizes("-3", 1);
78 testFontSizes("-4", 1);
79 testFontSizes("-5", 1);
80 testFontSizes("-6", 1);
81 testFontSizes("-7", 1);
82 testFontSizes("-8", 1);
83 testFontSizes("-9", 1);
84 testFontSizes("-10", 1);
85 testFontSizes("-10000000000000000000000", 1);
88 testFontSizes("+0", 3);
89 testFontSizes("+1", 4);
90 testFontSizes("+2", 5);
91 testFontSizes("+3", 6);
92 testFontSizes("+4", 7);
93 testFontSizes("+5", 7);
94 testFontSizes("+6", 7);
95 testFontSizes("+7", 7);
96 testFontSizes("+8", 7);
97 testFontSizes("+9", 7);
98 testFontSizes("+10", 7);
99 testFontSizes("+10000000000000000000000", 7);
101 // Non-HTML5 whitespace
102 testFontSize("\b1", 3);
103 testFontSize("\v1", 3);
104 testFontSize("\0u00a01", 3);