tor-browser

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

editable-state-and-focus-in-assigned-slot-dom.tentative.html (876B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <title>Testing editable state and focus in slotted editable element</title>
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 </head>
      9 <body>
     10 <div id="host">
     11 <div contenteditable></div>
     12 </div>
     13 <script>
     14 const text = 'A';
     15 test(() => {
     16  const host = document.querySelector('#host');
     17  const shadowRoot = host.attachShadow({ mode: "open" });
     18  const slot = document.createElement("slot");
     19  shadowRoot.appendChild(slot);
     20  const editable = document.querySelector('div[contenteditable]');
     21  editable.focus();
     22  document.execCommand('insertText', false, text);
     23  editable.blur();
     24  assert_equals(editable.innerText, text);
     25  editable.focus();
     26  document.execCommand('insertText', false, text);
     27  assert_equals(editable.innerText, text + text);
     28 });
     29 </script>
     30 </body>
     31 </html>