tor-browser

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

test_bug879319.html (3020B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=879319
      5 -->
      6 <head>
      7  <title>Test for Bug 879319</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script type="application/javascript" src="reflect.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=879319">Mozilla Bug 879319</a>
     14 
     15 <p id="msg"></p>
     16 
     17 <form id="form">
     18  <img id="img0" name="bar0" />
     19 </form>
     20 <input id="input0" name="foo0" form="form" />
     21 <input id="input1" name="foo1" form="form" />
     22 <input id="input2" name="foo2" form="form" />
     23 
     24 <pre id="test">
     25 <script type="application/javascript">
     26 
     27 /** Test for Bug 879319 */
     28 
     29 var input0 = document.getElementById("input0");
     30 ok(input0, "input0 exists");
     31 
     32 var form = document.getElementById("form");
     33 ok(form, "form exists");
     34 is(form.foo0, input0, "Form.foo0 should exist");
     35 
     36 ok("foo0" in form.elements, "foo0 in form.elements");
     37 is(input0.form, form, "input0.form is form");
     38 
     39 input0.setAttribute("name", "tmp0");
     40 ok("tmp0" in form.elements, "tmp0 is in form.elements");
     41 ok(!("foo0" in form.elements), "foo0 is not in form.elements");
     42 is(form.tmp0, input0, "Form.tmp0 == input0");
     43 is(form.foo0, input0, "Form.foo0 is still here");
     44 
     45 input0.setAttribute("name", "tmp1");
     46 ok("tmp1" in form.elements, "tmp1 is in form.elements");
     47 ok(!("tmp0" in form.elements), "tmp0 is not in form.elements");
     48 ok(!("foo0" in form.elements), "foo0 is not in form.elements");
     49 is(form.tmp0, input0, "Form.tmp0 == input0");
     50 is(form.tmp1, input0, "Form.tmp1 == input0");
     51 is(form.foo0, input0, "Form.foo0 is still here");
     52 
     53 input0.setAttribute("form", "");
     54 ok(!("foo0" in form.elements), "foo0 is not in form.elements");
     55 is(form.foo0, undefined, "Form.foo0 should not still be here");
     56 is(form.tmp0, undefined, "Form.tmp0 should not still be here");
     57 is(form.tmp1, undefined, "Form.tmp1 should not still be here");
     58 
     59 var input1 = document.getElementById("input1");
     60 ok(input1, "input1 exists");
     61 is(form.foo1, input1, "Form.foo1 should exist");
     62 
     63 ok("foo1" in form.elements, "foo1 in form.elements");
     64 is(input1.form, form, "input1.form is form");
     65 
     66 input1.setAttribute("name", "foo0");
     67 ok("foo0" in form.elements, "foo0 is in form.elements");
     68 is(form.foo0, input1, "Form.foo0 should be input1");
     69 is(form.foo1, input1, "Form.foo1 should be input1");
     70 
     71 var input2 = document.getElementById("input2");
     72 ok(input2, "input2 exists");
     73 is(form.foo2, input2, "Form.foo2 should exist");
     74 input2.remove();
     75 ok(!("foo2" in form.elements), "foo2 is not in form.elements");
     76 is(form.foo2, undefined, "Form.foo2 should not longer be there");
     77 
     78 var img0 = document.getElementById("img0");
     79 ok(img0, "img0 exists");
     80 is(form.bar0, img0, "Form.bar0 should exist");
     81 
     82 img0.setAttribute("name", "old_bar0");
     83 is(form.old_bar0, img0, "Form.bar0 is still here");
     84 is(form.bar0, img0, "Form.bar0 is still here");
     85 
     86 img0.remove();
     87 is(form.bar0, undefined, "Form.bar0 should not be here");
     88 
     89 </script>
     90 </pre>
     91 </body>
     92 </html>