tor-browser

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

document-with-fragment-empty.html (1129B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="resources/utils.js"></script>
      5 
      6 <iframe src="resources/frame-with-autofocus-element.html#"></iframe>
      7 
      8 <script>
      9 'use strict';
     10 
     11 promise_test(async () => {
     12  await waitForLoad(window);
     13  await waitUntilStableAutofocusState();
     14  assert_equals(document.activeElement, document.querySelector('iframe'),
     15      'Autofocus elements in iframes should be focused.');
     16 
     17  let input = document.createElement('input');
     18  input.autofocus = true;
     19  document.body.appendChild(input);
     20  await waitUntilStableAutofocusState();
     21  assert_not_equals(document.activeElement, input);
     22 }, 'Autofocus elements in iframed documents with empty fragments should work.');
     23 
     24 promise_test(async () => {
     25  let w = window.open('resources/frame-with-autofocus-element.html#');
     26  await waitForLoad(w);
     27  await waitUntilStableAutofocusState(w);
     28  assert_not_equals(w.document.activeElement, w.document.body);
     29  w.close();
     30 }, 'Autofocus elements in top-level browsing context\'s documents with empty fragments should work.');
     31 </script>