tor-browser

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

not-specificity.html (1743B)


      1 <!DOCTYPE html>
      2 <title>Specificity for complex :not selectors</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <link rel="help" href="https://drafts.csswg.org/selectors/#negation">
      6 <style>
      7  main :not(#foo) { --t0:PASS; }
      8  main :not(.foo) { --t0:FAIL; }
      9 
     10  main :not(div#foo) { --t1:PASS; }
     11  main :not(#foo) { --t1:FAIL; }
     12 
     13  main :not(.bar, #foo) { --t2:FAIL; }
     14  main :not(#foo, .bar) { --t2:PASS; }
     15 
     16  main :not(.bar, #foo) { --t3:PASS; }
     17  main :not(.foo, .bar) { --t3:FAIL; }
     18 
     19  main :not(span + span) { --t4:PASS; }
     20  main :not(span) { --t4:FAIL; }
     21 
     22  main :not(span, li, #foo) { --t5:PASS; }
     23  main :not(span, li, p) { --t5:FAIL; }
     24 
     25  main :not(span, :not(:not(.a#foo)), p) { --t6:PASS; }
     26  main :not(span, #foo, p) { --t6:FAIL; }
     27 
     28  main :not(span, #foo, p) { --t7:PASS; }
     29  main :not(span, :where(.a#foo), p) { --t7:FAIL; }
     30 </style>
     31 <main id=main>
     32  <div id=div></div>
     33 </main>
     34 <script>
     35  function test_value(name, description) {
     36    test(function() {
     37      let actual = getComputedStyle(div).getPropertyValue(name);
     38      assert_equals(actual, 'PASS');
     39    }, description);
     40  }
     41 
     42  test_value('--t0', ':not(#foo) wins over :not(.foo)');
     43  test_value('--t1', ':not(div#foo) wins over :not(#foo)');
     44  test_value('--t2', ':not(.bar, #foo) has same specificity as :not(#foo, .bar)');
     45  test_value('--t3', ':not(.bar, #foo) wins over :not(.foo, .bar)');
     46  test_value('--t4', ':not(span + span) wins over :not(span)');
     47  test_value('--t5', ':not(span, li, p) wins over :not(span, lo, p)');
     48  test_value('--t6', ':not(span, :not(:not(.a#foo)), p) wins over :not(span, #foo, p)');
     49  test_value('--t7', ':not(span, #foo, p) wins over :not(span, :where(.a#foo), p)');
     50 </script>