tor-browser

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

rule-restrictions.html (2561B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>CSSOM Should correctly honor property restrictions</title>
      4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
      5 <link rel="author" title="Mozilla" href="https://mozilla.org">
      6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1665816">
      7 <link rel="help" href="https://drafts.csswg.org/css-page-3/#conform-partial">
      8 <link rel="help" href="https://drafts.csswg.org/css-animations/#keyframes">
      9 <script src="/resources/testharness.js"></script>
     10 <script src="/resources/testharnessreport.js"></script>
     11 <style>
     12  @page {
     13    margin-top: 10px;
     14    transform: scale(1);
     15  }
     16 
     17  @keyframes foo {
     18    from {
     19      margin-top: 10px;
     20      animation-name: none;
     21    }
     22  }
     23 </style>
     24 <script>
     25 test(function() {
     26  let rule = document.styleSheets[0].cssRules[0];
     27  assert_equals(rule.type, CSSRule.PAGE_RULE, "Should be a page rule");
     28  assert_equals(rule.style.length, 1, "Transform doesn't quite apply to pages");
     29  assert_equals(rule.style.marginTop, "10px", "Should have a margin-top declaration");
     30  rule.style.setProperty("transform", "scale(1)");
     31  assert_equals(rule.style.getPropertyValue("transform"), "", "Shouldn't have been able to set the transform property via setProperty");
     32  assert_equals(rule.style.length, 1, "Shouldn't have been able to set transform via setProperty");
     33  rule.style.cssText = "margin-bottom: 10px; transform: scale(1);";
     34  assert_equals(rule.style.length, 1, "Should not have been able to set transform via cssText");
     35  assert_equals(rule.style.marginBottom, "10px", "Should have a margin-bottom declaration");
     36 }, "@page");
     37 
     38 test(function() {
     39  let rule = document.styleSheets[0].cssRules[1].cssRules[0];
     40  assert_equals(rule.type, CSSRule.KEYFRAME_RULE, "Should be a keyframe rule");
     41  assert_equals(rule.style.length, 1, "animation-name doesn't apply to keyframes");
     42  assert_equals(rule.style.marginTop, "10px", "Should have a margin-top declaration");
     43  rule.style.setProperty("animation-name", "none");
     44  assert_equals(rule.style.getPropertyValue("animation-name"), "", "Shouldn't have been able to set the animation-nameproperty via setProperty");
     45  assert_equals(rule.style.length, 1, "Shouldn't have been able to set animation-name via setProperty");
     46  rule.style.cssText = "margin-bottom: 10px; animation-name: none;";
     47  assert_equals(rule.style.length, 1, "Should not have been able to set animation-name via cssText");
     48  assert_equals(rule.style.marginBottom, "10px", "Should have a margin-bottom declaration");
     49 
     50 }, "@keyframe");
     51 </script>