tor-browser

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

inserttext-at-end-of-block-when-br-always-block.html (1033B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <title>Typing white-space and another character at end of a block should preserve the white-space when br element is always block</title>
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <style>
      9 br { display: block; }
     10 </style>
     11 <script>
     12 "use strict";
     13 
     14 addEventListener("load", () => {
     15  test(
     16    () => {
     17      const editingHost = document.querySelector("div[contenteditable]");
     18      editingHost.focus();
     19      getSelection().collapse(editingHost.firstChild, "abc".length);
     20      document.execCommand("insertText", false, " ");
     21      document.execCommand("insertText", false, "d");
     22      assert_in_array(
     23        editingHost.innerHTML,
     24        [
     25          "abc d",
     26          "abc d<br>",
     27        ]
     28      );
     29    },
     30    "Inserting white-space and a character at block end should keep the white-space even before block <br> element"
     31  );
     32 }, {once: true});
     33 </script>
     34 </head>
     35 <body><div contenteditable>abc</div></body>
     36 </html>