2 body {font-size:
12px;}
3 #control {font: italic small-caps
900 150%/
2em monospace;}
4 #calc {font: italic small-caps
900 calc(
150%)/
2em monospace;}
8 <span id=
"control">The font size and line height of these lines should be identical
</span>
10 <span id=
"calc">The font size and line height of these lines should be identical
</span>
13 <div id=
"results"></div>
16 if (window
.testRunner
)
17 testRunner
.dumpAsText();
18 var controlHeight
= getComputedStyle(document
.getElementById("control"), null).lineHeight
;
19 var controlSize
= getComputedStyle(document
.getElementById("control"), null).fontSize
;
21 var spans
= document
.getElementsByTagName("span");
22 var sameHeight
= true;
24 for (var i
= 0; i
< spans
.length
; ++i
) {
25 var current
= spans
[i
];
27 sameHeight
= getComputedStyle(current
, null).lineHeight
== controlHeight
;
29 sameSize
= getComputedStyle(current
, null).fontSize
== controlSize
;
32 var results
= document
.getElementById("results");
33 if (sameHeight
&& sameSize
) {
34 results
.style
.color
= "green";
35 results
.innerHTML
= "PASS";
37 results
.style
.color
= "red";
38 results
.innerHTML
= "FAIL";
40 results
.innerHTML
+= "<p>Line heights do not match</p>";
42 results
.innerHTML
+= "<p>Font sizes do not match</p>";