tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

rgba-011.html (1854B)


      1 <!DOCTYPE html>
      2 
      3  <meta charset="UTF-8">
      4 
      5  <title>CSS Values and Units Test: rgba() function syntax (complex)</title>
      6 
      7  <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
      8  <link rel="help" href="https://www.w3.org/TR/css-color-3/#rgba-color">
      9  <link rel="help" href="https://www.w3.org/TR/css-color-4/#rgb-functions">
     10  <link rel="help" href="https://www.w3.org/TR/css-values-4/#combine-integers">
     11 
     12  <meta name="assert" content="This test checks the syntax allowed by rgba() function. White space characters, instead of commas, are allowed between numerical values. <alpha-value> can be omitted for rgba() function, in which case it must defaults to 100%. Finally, rgba() function can take real numbers but their computed values will be rounded to the nearest integer, with values halfway between adjacent integers rounded towards positive infinity.">
     13 
     14  <script src="/resources/testharness.js"></script>
     15 
     16  <script src="/resources/testharnessreport.js"></script>
     17 
     18  <div id="log"></div>
     19 
     20  <div id="target"></div>
     21 
     22  <script>
     23  function startTesting()
     24  {
     25 
     26    var targetElement = document.getElementById("target");
     27 
     28    function compareValue(property_name, calcValue, expectedValue, description)
     29    {
     30 
     31    test(function()
     32      {
     33 
     34      targetElement.style.setProperty(property_name, calcValue);
     35 
     36      var computedCalcValue = getComputedStyle(targetElement)[property_name];
     37 
     38      targetElement.style.setProperty(property_name, expectedValue);
     39 
     40      var computedExpectedValue = getComputedStyle(targetElement)[property_name];
     41 
     42      assert_equals(computedCalcValue, computedExpectedValue);
     43 
     44      }, description);
     45    }
     46 
     47    compareValue("background-color", "rgba(0.4 127.5 0.3)", "rgb(0, 128, 0)", "testing background-color: rgba(0.4 127.5 0.3)");
     48 
     49  }
     50 
     51  startTesting();
     52 
     53  </script>