tor-browser

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

container-nested.html (5525B)


      1 <!doctype html>
      2 <title>@container (nested)</title>
      3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-rule">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="support/cq-testcommon.js"></script>
      7 <style>
      8 
      9 #outer {
     10  container-name: outer;
     11  container-type: size;
     12  width: 100px;
     13  height: 100px;
     14 }
     15 
     16 #inner {
     17  container-name: inner;
     18  container-type: size;
     19  width: 50px;
     20  height: 50px;
     21 }
     22 </style>
     23 <div id=outer>
     24  <div id=inner>
     25    <div id=child></div>
     26  </div>
     27 </div>
     28 <script>
     29  setup(() => assert_implements_size_container_queries());
     30 </script>
     31 
     32 <!--
     33  "Implicit" refers to implicit container selection, i.e. understanding which
     34  container to evaluate against by looking at the features used.
     35 -->
     36 
     37 <style>
     38  @container (width: 50px) {
     39    @container (height: 50px) {
     40      #child { --implicit:true; }
     41    }
     42  }
     43 </style>
     44 <script>
     45  test(() => {
     46    assert_equals(getComputedStyle(child).getPropertyValue('--implicit'), 'true');
     47  }, 'Implicit');
     48 </script>
     49 
     50 
     51 <style>
     52  @container (width: 70px) {
     53    @container (height: 50px) {
     54      #child { --implicit-outer-fail:true; }
     55    }
     56  }
     57 </style>
     58 <script>
     59  test(() => {
     60    assert_equals(getComputedStyle(child).getPropertyValue('--implicit-outer-fail'), '');
     61  }, 'Implicit, outer failing');
     62 </script>
     63 
     64 
     65 <style>
     66  @container (width: 50px) {
     67    @container (height: 70px) {
     68      #child { --implicit-inner-fail:true; }
     69    }
     70  }
     71 </style>
     72 <script>
     73  test(() => {
     74    assert_equals(getComputedStyle(child).getPropertyValue('--implicit-inner-fail'), '');
     75  }, 'Implicit, inner failing');
     76 </script>
     77 
     78 
     79 <style>
     80  @container outer (width: 100px) {
     81    @container inner (height: 50px) {
     82      #child { --named-outer-inner:true; }
     83    }
     84  }
     85 </style>
     86 <script>
     87  test(() => {
     88    assert_equals(getComputedStyle(child).getPropertyValue('--named-outer-inner'), 'true');
     89  }, 'Outer named, inner named');
     90 </script>
     91 
     92 
     93 <style>
     94  @container inner (width: 50px) {
     95    @container outer (height: 100px) {
     96      #child { --named-outer-inner-reverse:true; }
     97    }
     98  }
     99 </style>
    100 <script>
    101  test(() => {
    102    assert_equals(getComputedStyle(child).getPropertyValue('--named-outer-inner-reverse'), 'true');
    103  }, 'Outer named, inner named (reverse)');
    104 </script>
    105 
    106 
    107 <style>
    108  @container unknown (width: 100px) {
    109    @container inner (height: 50px) {
    110      #child { --named-failing-outer:true; }
    111    }
    112  }
    113 </style>
    114 <script>
    115  test(() => {
    116    assert_equals(getComputedStyle(child).getPropertyValue('--named-failing-outer'), '');
    117  }, 'Failing outer name');
    118 </script>
    119 
    120 <style>
    121  @container outer (width: 100px) {
    122    @container unknown (height: 50px) {
    123      #child { --named-failing-inner:true; }
    124    }
    125  }
    126 </style>
    127 <script>
    128  test(() => {
    129    assert_equals(getComputedStyle(child).getPropertyValue('--named-failing-inner'), '');
    130  }, 'Failing inner name');
    131 </script>
    132 
    133 
    134 <style>
    135  @container outer (width: 100px) {
    136    @container (height: 50px) {
    137      #child { --named-outer-inner-implicit:true; }
    138    }
    139  }
    140 </style>
    141 <script>
    142  test(() => {
    143    assert_equals(getComputedStyle(child).getPropertyValue('--named-outer-inner-implicit'), 'true');
    144  }, 'Outer named, inner implicit');
    145 </script>
    146 
    147 
    148 <style>
    149  @container (width: 50px) {
    150    @container inner (height: 50px) {
    151      #child { --implicit-outer-inner-named:true; }
    152    }
    153  }
    154 </style>
    155 <script>
    156  test(() => {
    157    assert_equals(getComputedStyle(child).getPropertyValue('--implicit-outer-inner-named'), 'true');
    158  }, 'Inner named, outer implicit');
    159 </script>
    160 
    161 
    162 <style>
    163  @container (width: 50px) {
    164    @container outer (height: 100px) {
    165      #child { --implicit-outer-inner-named-reverse:true; }
    166    }
    167  }
    168 </style>
    169 <script>
    170  test(() => {
    171    assert_equals(getComputedStyle(child).getPropertyValue('--implicit-outer-inner-named-reverse'), 'true');
    172  }, 'Inner named, outer implicit (reverse)');
    173 </script>
    174 
    175 
    176 <style>
    177  @container (width > 1px) {
    178    @container (width > 2px) {
    179      @container (width > 3px) {
    180        #child { --three-levels:true; }
    181      }
    182    }
    183  }
    184 </style>
    185 <script>
    186  test(() => {
    187    assert_equals(getComputedStyle(child).getPropertyValue('--three-levels'), 'true');
    188  }, 'Three levels');
    189 </script>
    190 
    191 
    192 <style>
    193  @container (width > 1px) {
    194    @container (width > 2000px) {
    195      @container (width > 3px) {
    196        #child { --three-levels-middle-fail:true; }
    197      }
    198    }
    199  }
    200 </style>
    201 <script>
    202  test(() => {
    203    assert_equals(getComputedStyle(child).getPropertyValue('--three-levels-middle-fail'), '');
    204  }, 'Three levels, middle fail');
    205 </script>
    206 
    207 
    208 <style>
    209  @container (width: 50px) {
    210    @container outer (height: 100px) {
    211      #child { --inner-named-invalidation:true; }
    212    }
    213  }
    214 </style>
    215 <script>
    216  test((t) => {
    217    t.add_cleanup(() => { outer.style = ''; });
    218    assert_equals(getComputedStyle(child).getPropertyValue('--inner-named-invalidation'), 'true');
    219    outer.style.height = '200px';
    220    assert_equals(getComputedStyle(child).getPropertyValue('--inner-named-invalidation'), '');
    221  }, 'Named inner invalidation');
    222 </script>
    223 
    224 
    225 <style>
    226  @container (width: 50px) {
    227    @container outer (height: 100px) {
    228      #child { --outer-implicit-invalidation:true; }
    229    }
    230  }
    231 </style>
    232 <script>
    233  test((t) => {
    234    t.add_cleanup(() => { inner.style = ''; });
    235    assert_equals(getComputedStyle(child).getPropertyValue('--outer-implicit-invalidation'), 'true');
    236    inner.style.width = '200px';
    237    assert_equals(getComputedStyle(child).getPropertyValue('--outer-implicit-invalidation'), '');
    238  }, 'Implicit outer invalidation');
    239 </script>