4 https://bugzilla.mozilla.org/show_bug.cgi?id=375363
7 <title>Test for parsing, storage, and serialization of CSS '-moz-initial'
</title>
8 <script type=
"text/javascript" src=
"/MochiKit/MochiKit.js"></script>
9 <script type=
"text/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <script type=
"text/javascript" src=
"property_database.js"></script>
11 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
14 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=375363">Mozilla Bug
375363</a>
16 <div id=
"content" style=
"display: none">
18 <div id=
"testnode"></div>
22 <script class=
"testbody" type=
"text/javascript">
24 /** Test for parsing, storage, and serialization of CSS '-moz-initial' **/
26 var gDeclaration = document.getElementById(
"testnode").style;
29 "-moz-border-end": true,
30 "-moz-border-radius": true,
31 "-moz-border-start": true,
32 "-moz-column-rule": true,
33 "-moz-outline-radius": true,
36 "border-bottom": true,
47 function test_property(property)
49 var info = gCSSProperties[property];
51 function check_initial(sproperty) {
52 var sinfo = gCSSProperties[sproperty];
53 var val = gDeclaration.getPropertyValue(sproperty);
54 is(val,
"",
"value of '" + sproperty +
"' before we do anything");
56 is(val, gDeclaration[sinfo.domProp],
57 "consistency between decl.getPropertyValue('" + sproperty +
"') and decl." + sinfo.domProp);
60 check_initial(property);
61 if (
"subproperties" in info)
62 for (var idx in info.subproperties)
63 check_initial(info.subproperties[idx]);
65 gDeclaration.setProperty(property,
"-moz-initial",
"");
67 function check_set(sproperty) {
68 var sinfo = gCSSProperties[sproperty];
69 val = gDeclaration.getPropertyValue(sproperty);
70 is(val,
"-moz-initial",
71 "-moz-initial reported back for property '" + sproperty +
"'");
73 is(val, gDeclaration[sinfo.domProp],
74 "consistency between decl.getPropertyValue('" + sproperty +
75 "') and decl." + sinfo.domProp);
79 if (
"subproperties" in info)
80 for (var idx in info.subproperties)
81 check_set(info.subproperties[idx]);
83 // We don't care particularly about the whitespace or the placement of
84 // semicolons, but for simplicity we'll test the current behavior.
86 if (property in gKnownFails2)
87 cssTextFunc = todo_is;
88 cssTextFunc(gDeclaration.cssText, property +
": -moz-initial;",
89 "declaration should serialize to exactly what went in (for -moz-initial)");
91 gDeclaration.removeProperty(property);
93 function check_final(sproperty) {
94 var sinfo = gCSSProperties[sproperty];
95 var val = gDeclaration.getPropertyValue(sproperty);
96 is(val,
"",
"value of '" + sproperty +
"' after removal of value");
98 is(val, gDeclaration[sinfo.domProp],
99 "consistency between decl.getPropertyValue('" + sproperty +
"') and decl." + sinfo.domProp);
102 check_final(property);
103 if (
"subproperties" in info)
104 for (var idx in info.subproperties)
105 check_final(info.subproperties[idx]);
108 for (var prop in gCSSProperties)