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.

Mercurial (a81015259a98)

VCS Links

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 86 87 88 89 90 91 92 93 94 95 96 97 98
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=377947
-->
<head>
  <title>Test for Bug 377947</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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=377947">Mozilla Bug 377947</a>
<p id="display"></p>
<div id="content" style="display: none">
  
</div>
<pre id="test">
<script class="testbody" type="text/javascript">

/** Test for Bug 377947 **/

/*
 * In particular, test that CSSStyleDeclaration.getPropertyValue doesn't
 * return values for shorthands when some of the subproperties are not
 * specified (a change that wasn't all that related to the main point of
 * the bug).  And also test that the internal system-font property added
 * in bug 377947 doesn't interfere with that.
 */

var s = document.getElementById("display").style;

is(s.getPropertyValue("list-style"), "",
   "list-style shorthand should start off empty");
s.listStyleType="disc";
s.listStyleImage="none";
is(s.getPropertyValue("list-style"), "",
   "list-style shorthand should be empty when some subproperties specified");
s.listStylePosition="inside";
isnot(s.getPropertyValue("list-style"), "",
      "list-style shorthand should produce value when all subproperties set");
s.removeProperty("list-style");
is(s.getPropertyValue("list-style"), "",
   "list-style shorthand be empty after removal");
s.listStyle="none";
isnot(s.getPropertyValue("list-style"), "",
      "list-style shorthand should produce value when shorthand set");
s.removeProperty("list-style");
is(s.getPropertyValue("list-style"), "",
   "list-style shorthand be empty after removal");

is(s.getPropertyValue("font"), "",
   "font shorthand should start off empty");
var all_but_one = {
  "font-family": "serif",
  "font-style": "normal",
  "font-variant": "normal",
  "font-weight": "bold",
  "font-size": "small",
  "font-size-adjust": "none", // has to be default value
  "font-stretch": "normal", // has to be default value
  "-moz-font-feature-settings": "normal", // has to be default value
  "-moz-font-language-override": "normal" // has to be default value
};
for (var prop in all_but_one) {
  s.setProperty(prop, all_but_one[prop], "");
}
is(s.getPropertyValue("font"), "",
   "font shorthand should be empty when some subproperties specified");
s.setProperty("line-height", "1.5", "");
isnot(s.getPropertyValue("font"), "",
      "font shorthand should produce value when all subproperties set");
s.setProperty("font-stretch", "condensed", "");
is(s.getPropertyValue("font"), "",
   "font shorthand should be empty when font-stretch is non-default");
s.setProperty("font-stretch", "normal", "");
isnot(s.getPropertyValue("font"), "",
      "font shorthand should produce value when all subproperties set");
s.removeProperty("font");
is(s.getPropertyValue("font"), "",
   "font shorthand be empty after removal");
s.font="medium serif";
isnot(s.getPropertyValue("font"), "",
      "font shorthand should produce value when shorthand set");
s.removeProperty("font");
is(s.getPropertyValue("font"), "",
   "font shorthand be empty after removal");
s.font="menu";
isnot(s.getPropertyValue("font"), "",
      "font shorthand should produce value when shorthand (system font) set");
s.removeProperty("font");
is(s.getPropertyValue("font"), "",
   "font shorthand be empty after removal");

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