OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 if (window.testRunner) | 4 if (window.testRunner) |
5 testRunner.dumpAsText(); | 5 testRunner.dumpAsText(); |
6 </script> | 6 </script> |
7 </head> | 7 </head> |
8 <body> | 8 <body> |
9 <div id="foo">Test</div> | 9 <div id="foo">Test</div> |
10 <script> | 10 <script> |
11 function testFontValue(value) | 11 function testFontValue(value) |
12 { | 12 { |
13 document.write("Font for '" + value + "':<br>"); | 13 document.write("Font for '" + value + "':<br>"); |
14 var element = document.getElementById("foo"); | 14 var element = document.getElementById("foo"); |
15 var decl = element.style; | 15 var decl = element.style; |
16 decl.font = ""; | 16 decl.font = ""; |
17 decl.font = value; | 17 decl.font = value; |
18 for (var i = 0; i < decl.length; i++) { | 18 for (var i = 0; i < decl.length; i++) { |
19 var shorthand = decl.getPropertyShorthand(decl[i]); | |
20 document.write(decl[i] + ": " + decl.getPropertyValue(decl[i])); | 19 document.write(decl[i] + ": " + decl.getPropertyValue(decl[i])); |
21 if (shorthand) { | |
22 document.write(" (original property was " + shorthand | |
23 + (decl.isPropertyImplicit(decl[i]) ? " and property was implici
tly set.)" : ")")); | |
24 } | |
25 document.write("<br>"); | 20 document.write("<br>"); |
26 } | 21 } |
27 document.write("<br>"); | 22 document.write("<br>"); |
28 } | 23 } |
29 | 24 |
30 testFontValue("12px monospace"); | 25 testFontValue("12px monospace"); |
31 testFontValue("12px/24px serif"); | 26 testFontValue("12px/24px serif"); |
32 testFontValue("normal 12px serif"); | 27 testFontValue("normal 12px serif"); |
33 testFontValue("normal normal 12px serif"); | 28 testFontValue("normal normal 12px serif"); |
34 testFontValue("normal normal normal 12px serif"); | 29 testFontValue("normal normal normal 12px serif"); |
35 testFontValue("italic small-caps 12px/24px serif"); | 30 testFontValue("italic small-caps 12px/24px serif"); |
36 testFontValue("italic bold 12px/24px serif"); | 31 testFontValue("italic bold 12px/24px serif"); |
37 testFontValue("small-caps bold 14px/28px Arial, sans-serif"); | 32 testFontValue("small-caps bold 14px/28px Arial, sans-serif"); |
38 testFontValue("italic small-caps bold 14px/28px Arial, sans-serif"); | 33 testFontValue("italic small-caps bold 14px/28px Arial, sans-serif"); |
39 | 34 |
40 // Invalid values should yield no longhands. | 35 // Invalid values should yield no longhands. |
41 testFontValue("italic small-caps bold 12px/24px"); | 36 testFontValue("italic small-caps bold 12px/24px"); |
42 testFontValue("italic small-caps bold 12px"); | 37 testFontValue("italic small-caps bold 12px"); |
43 testFontValue("italic small-caps bold /12px serif"); | 38 testFontValue("italic small-caps bold /12px serif"); |
44 testFontValue("italic small-caps small-caps 12px serif"); | 39 testFontValue("italic small-caps small-caps 12px serif"); |
45 testFontValue("italic italic small-caps bold 12px serif"); | 40 testFontValue("italic italic small-caps bold 12px serif"); |
46 testFontValue("12px/italic serif"); | 41 testFontValue("12px/italic serif"); |
47 </script> | 42 </script> |
48 </body> | 43 </body> |
49 </html> | 44 </html> |
OLD | NEW |