tor-browser

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

last-child.html (1208B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <title>CSS Selectors :last-child</title>
      6 <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-last-child-pseudo">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <!--
     10  See also:
     11  * child-indexed-pseudo-class.html
     12  * child-indexed-no-parent.html
     13  * invalidation/first-child-last-child.html
     14 -->
     15 <body>
     16 
     17 <div>
     18  <div id="target1">Whitespace nodes should be ignored.</div>
     19 </div>
     20 
     21 <div>
     22  <blockquote></blockquote>
     23  <div id="target2">There is a prior child element.</div>
     24 </div>
     25 
     26 <div>
     27  <div id="target3">A comment node should be ignored.</div>
     28  <!-- -->
     29 </div>
     30 
     31 <div>
     32  <div id="target4">Non-whitespace text node should be ignored.</div>
     33  .
     34 </div>
     35 
     36 <div>
     37  <div id="target5" data-expected="false">The first child should not be matched.</div>
     38  <blockquote></blockquote>
     39 </div>
     40 
     41 <script>
     42 for (let i = 1; i <= 5; ++i) {
     43  let target = document.querySelector(`#target${i}`);
     44  test(() => {
     45    if (target.dataset.expected == 'false')
     46      assert_false(target.matches(':last-child'));
     47    else
     48      assert_true(target.matches(':last-child'));
     49  }, target.textContent);
     50 }
     51 </script>