|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=475214 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 475214</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
10 </head> |
|
11 <body> |
|
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=475214">Mozilla Bug 475214</a> |
|
13 <p id="display"></p> |
|
14 <div id="content"> |
|
15 |
|
16 </div> |
|
17 <pre id="test"> |
|
18 <script type="application/javascript"> |
|
19 |
|
20 /** Test for Bug 475214 **/ |
|
21 |
|
22 var e = document.getElementById("content"); |
|
23 var s = e.style; |
|
24 |
|
25 e.style.font = "menu"; |
|
26 is(e.style.cssText, "font: menu;", "serialize system font alone"); |
|
27 is(e.style.font, "menu", "font getter returns value"); |
|
28 |
|
29 e.style.fontFamily = "inherit"; |
|
30 is(e.style.cssText, "font: menu; font-family: inherit;", "serialize system font and font-family"); |
|
31 is(e.style.font, "", "font getter should be empty"); |
|
32 |
|
33 e.style.font = "message-box"; |
|
34 is(e.style.cssText, "font: message-box;", "serialize system font alone"); |
|
35 is(e.style.font, "message-box", "font getter returns value"); |
|
36 |
|
37 e.setAttribute("style", "font-weight:bold;font:caption;line-height:3;"); |
|
38 is(e.style.cssText, "font: caption; line-height: 3;", "serialize system font and font-family"); |
|
39 is(e.style.font, "", "font getter should be empty"); |
|
40 |
|
41 e.setAttribute("style", "font: menu; font-weight: -moz-use-system-font"); |
|
42 is(e.style.cssText, "font: menu;", "serialize system font alone"); |
|
43 is(e.style.font, "menu", "font getter returns value"); |
|
44 |
|
45 e.setAttribute("style", "font: menu; font-weight: -moz-use-system-font ! important"); |
|
46 is(e.style.cssText, "font: menu; font-weight: -moz-use-system-font ! important;", "serialize system font and subproperty that is important"); |
|
47 is(e.style.font, "", "font getter returns nothing"); |
|
48 |
|
49 e.setAttribute("style", "font: inherit; font-family: Helvetica;"); |
|
50 |
|
51 var cssTextStr = "font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit; -moz-font-feature-settings: inherit; -moz-font-language-override: inherit;"; |
|
52 if (SpecialPowers.getBoolPref("layout.css.font-features.enabled")) { |
|
53 cssTextStr += " font-kerning: inherit; font-synthesis: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit;" |
|
54 } |
|
55 |
|
56 is(e.style.cssText, cssTextStr + " font-family: Helvetica;", "don't serialize system font for font:inherit"); |
|
57 is(e.style.font, "", "font getter returns nothing"); |
|
58 |
|
59 </script> |
|
60 </pre> |
|
61 </body> |
|
62 </html> |