tor-browser

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

test_bug458037.xhtml (2857B)


      1 <html xmlns="http://www.w3.org/1999/xhtml"
      2      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=458037
      5 -->
      6 <head>
      7  <title>Test for Bug 458037</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>        
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     10 </head>
     11 <body>
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=458037">Mozilla Bug 458037</a>
     13 <p id="display"></p>
     14 <div id="content" >
     15 <div id="a"></div>
     16 <div id="b" contenteditable="true"></div>
     17 <div id="c" contenteditable="false"></div>
     18 <div id="d" contenteditable="inherit"></div>
     19 <div contenteditable="true">
     20  <div id="e"></div>
     21 </div>
     22 <div contenteditable="false">
     23  <div id="f"></div>
     24 </div>
     25 <div contenteditable="true">
     26  <div id="g" contenteditable="false"></div>
     27 </div>
     28 <div contenteditable="false">
     29  <div id="h" contenteditable="true"></div>
     30 </div>
     31 <div contenteditable="true">
     32  <div id="i" contenteditable="inherit"></div>
     33 </div>
     34 <div contenteditable="false">
     35  <div id="j" contenteditable="inherit"></div>
     36 </div>
     37 <div contenteditable="true">
     38  <xul:box>
     39    <div id="k"></div>
     40  </xul:box>
     41 </div>
     42 <div contenteditable="false">
     43  <xul:box>
     44    <div id="l"></div>
     45  </xul:box>
     46 </div>
     47 <div contenteditable="true">
     48  <xul:box>
     49    <div id="m" contenteditable="inherit"></div>
     50  </xul:box>
     51 </div>
     52 <div contenteditable="false">
     53  <xul:box>
     54    <div id="n" contenteditable="inherit"></div>
     55  </xul:box>
     56 </div>
     57 <div id="x"></div>
     58 </div>
     59 <pre id="test">
     60 <script class="testbody" type="text/javascript">
     61 
     62 /** Test for Bug 458037 */
     63 
     64 function test(id, expected) {
     65  is(document.getElementById(id).isContentEditable, expected,
     66     "Element " + id + " should " + (expected ? "" : "not ") + "be editable");
     67 }
     68 
     69 document.addEventListener("DOMContentLoaded", function() {
     70  test("a", false);
     71  test("b", true);
     72  test("c", false);
     73  test("d", false);
     74  test("e", true);
     75  test("f", false);
     76  test("g", false);
     77  test("h", true);
     78  test("i", true);
     79  test("j", false);
     80  test("k", true);
     81  test("l", false);
     82  test("m", true);
     83  test("n", false);
     84 
     85  var d = document.getElementById("x");
     86  test("x", false);
     87  d.setAttribute("contenteditable", "true");
     88  test("x", true);
     89  d.setAttribute("contenteditable", "false");
     90  test("x", false);
     91  d.setAttribute("contenteditable", "inherit");
     92  test("x", false);
     93  d.removeAttribute("contenteditable");
     94  test("x", false);
     95  d.contentEditable = "true";
     96  test("x", true);
     97  d.contentEditable = "false";
     98  test("x", false);
     99  d.contentEditable = "inherit";
    100  test("x", false);
    101 
    102  // Make sure that isContentEditable is read-only
    103  var origValue = d.isContentEditable;
    104  d.isContentEditable = !origValue;
    105  is(d.isContentEditable, origValue, "isContentEditable should be read only");
    106 });
    107 
    108 </script>
    109 </pre>
    110 </body>
    111 </html>