tor-browser

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

nested-rules-001.html (1553B)


      1 <!DOCTYPE html>
      2 <link rel="author" title="Mozilla" href="https://mozilla.org">
      3 <link rel="help" href="https://drafts.csswg.org/css-page-3/#syntax-page-selector">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <style>
      7 @page p0{
      8  @page a{ size: letter; }
      9 }
     10 @page p1{
     11  @namespace svg url(http://www.w3.org/2000/svg);
     12 }
     13 @page p2{
     14  @font-face{}
     15 }
     16 @page p3{
     17  @font-feature-values font one{}
     18 }
     19 @page p4{
     20  @font-palette-values --alternate{}
     21 }
     22 @page p5{
     23  @counter-style x{}
     24 }
     25 @page p6{
     26  @keyframes y{}
     27 }
     28 @page p7{
     29  @property z{
     30    syntax: "<color>";
     31    inherits: false;
     32    initial-value: #c0ffee;
     33  }
     34 }
     35 @page p8{
     36  @import url("style.css") screen;
     37 }
     38 </style>
     39 
     40 <script>
     41 'use strict';
     42 test(t => {
     43  assert_equals(document.styleSheets.length, 1);
     44  let styleSheet = document.styleSheets[0];
     45  const ruleTypes = [
     46    "page",
     47    "namespace",
     48    "font-face",
     49    "font-feature-values",
     50    "font-palette-values",
     51    "counter-style",
     52    "keyframes",
     53    "property",
     54    "import"
     55  ];
     56  assert_equals(styleSheet.rules.length, ruleTypes.length);
     57  for(let i = 0; i < styleSheet.rules.length; i++){
     58    // Just test that this is the right rule first.
     59    assert_equals(styleSheet.rules[i].selectorText, "p" + i,
     60        "@page p" + i + " was not parsed at all");
     61    // Test that the nested rule was not valid.
     62    assert_equals(styleSheet.rules[i].cssText, "@page p" + i + " { }",
     63        "@" + ruleTypes[i] + " rules should not be allowed in @page rules");
     64  }
     65 }, "nested-rules-001");
     66 </script>