tor-browser

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

label-inside-anchor.html (1087B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>label element: clicking on label containing inline element placed inside &lt;a&gt; </title>
      4 <link rel="author" title="Yu Han" href="mailto:yuzhehan@chromium.org">
      5 <link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#the-label-element">
      6 <link rel="help" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 
     10 <a href="javascript:void(0)" target="_blank">
     11    <label for="peas"><span id="text">peas?</span></label>
     12    <input type="checkbox" name="peas" id="peas">
     13 </a>
     14 <script>
     15  const text = document.getElementById('text'),
     16        peas_cb =  document.getElementById('peas');
     17 
     18  t1 = async_test("click on inline element inside a label that's placed inside a anchor should trigger default label behavior");
     19 
     20  peas_cb.onchange = t1.step_func_done(function(e) {
     21    assert_true(peas_cb.checked, "checkbox is checked");
     22  });
     23 
     24  t1.step(function() {
     25    text.click();
     26  });
     27 
     28 </script>