DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=375363
-->
<head>
  <title>Test for parsing, storage, and serialization of CSS '-moz-initial'</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="property_database.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=375363">Mozilla Bug 375363</a>
<p id="display"></p>
<div id="content" style="display: none">

<div id="testnode"></div>
  
</div>
<pre id="test">
<script class="testbody" type="text/javascript">

/** Test for parsing, storage, and serialization of CSS '-moz-initial' **/

var gDeclaration = document.getElementById("testnode").style;

function test_property(property)
{
  var info = gCSSProperties[property];

  function check_initial(sproperty) {
    var sinfo = gCSSProperties[sproperty];
    var val = gDeclaration.getPropertyValue(sproperty);
    is(val, "", "value of '" + sproperty + "' before we do anything");
    is(val, gDeclaration[sinfo.domProp],
       "consistency between decl.getPropertyValue('" + sproperty + "') and decl." + sinfo.domProp);
  }
  check_initial(property);
  if ("subproperties" in info)
    for (var idx in info.subproperties)
      check_initial(info.subproperties[idx]);

  gDeclaration.setProperty(property, "-moz-initial", "");

  function check_set(sproperty) {
    var sinfo = gCSSProperties[sproperty];
    val = gDeclaration.getPropertyValue(sproperty);
    is(val, "-moz-initial",
       "-moz-initial reported back for property '" + sproperty + "'");
    is(val, gDeclaration[sinfo.domProp],
       "consistency between decl.getPropertyValue('" + sproperty +
       "') and decl." + sinfo.domProp);
  }
  check_set(property);
  if ("subproperties" in info)
    for (var idx in info.subproperties)
      check_set(info.subproperties[idx]);

  // We don't care particularly about the whitespace or the placement of
  // semicolons, but for simplicity we'll test the current behavior.
  is(gDeclaration.cssText, property + ": -moz-initial;",
    "declaration should serialize to exactly what went in (for -moz-initial)");

  gDeclaration.removeProperty(property);

  function check_final(sproperty) {
    var sinfo = gCSSProperties[sproperty];
    var val = gDeclaration.getPropertyValue(sproperty);
    is(val, "", "value of '" + sproperty + "' after removal of value");
    is(val, gDeclaration[sinfo.domProp],
       "consistency between decl.getPropertyValue('" + sproperty + "') and decl." + sinfo.domProp);
  }
  check_final(property);
  if ("subproperties" in info)
    for (var idx in info.subproperties)
      check_final(info.subproperties[idx]);
}

for (var prop in gCSSProperties)
  test_property(prop);

</script>
</pre>
</body>
</html>