tor-browser

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

Event-stopPropagation-cancel-bubbling.html (640B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <body>
      7 <script>
      8 test(t => {
      9  const element = document.createElement('div');
     10 
     11  element.addEventListener('click', () => {
     12    event.stopPropagation();
     13  }, { capture: true });
     14 
     15  element.addEventListener('click',
     16    t.unreached_func('stopPropagation in the capture handler should have canceled this bubble handler.'));
     17 
     18  element.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
     19 });
     20 </script>