Bug 422974 ? Prism uses old "Remember password?" mechanism. r=gavin
[wine-gecko.git] / content / base / test / test_bug311681.xml
blob5e704ac890b6eda35cb4ce6ddf181a68b6bedd42
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=311681
4 -->
5 <head>
6   <title>Test for Bug 311681</title>
7   <script type="text/javascript" src="/MochiKit/packed.js"></script>
8   <script type="text/javascript" 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=311681">Mozilla Bug 311681</a>
13 <script class="testbody" type="text/javascript">
14 <![CDATA[
15   // Setup script
16   SimpleTest.waitForExplicitFinish();
18   // Make sure to trigger the hashtable case by asking for enough elements
19   // by ID.
20   for (var i = 0; i < 256; ++i) {
21     var x = document.getElementById(i);
22   }
24   // save off the document.getElementById function, since getting it as a
25   // property off the document it causes a content flush.      
26   var fun = document.getElementById;
28   // Slot for our initial element with id "content"
29   var testNode;
31   function getCont() {
32     return fun.call(document, "content");
33   }
34   
35   function testClone() {
36     // Test to make sure that if we have multiple nodes with the same ID in
37     // a document we don't forget about one of them when the other is
38     // removed.
39     var newParent = $("display");
40     var node = testNode.cloneNode(true);
41     isnot(node, testNode, "Clone should be a different node");
43     newParent.appendChild(node);
45     // Check what getElementById returns, no flushing
46     is(getCont(), node, "Should be getting orig node pre-flush 1");
47     
48     // Trigger a layout flush, just in case.
49     var itemHeight = newParent.offsetHeight/10;
51     // Check what getElementById returns now.
52     is(getCont(), node, "Should be getting new node post-flush 1");
53     
54     clear(newParent);
55     
56     // Check what getElementById returns, no flushing
57     is(getCont(), testNode, "Should be getting orig node pre-flush 2");
58     
59     // Trigger a layout flush, just in case.
60     var itemHeight = newParent.offsetHeight/10;
62     // Check what getElementById returns now.
63     is(getCont(), testNode, "Should be getting orig node post-flush 2");
65     node = testNode.cloneNode(true);
66     newParent.appendChild(node);
67     testNode.parentNode.removeChild(testNode);
69     // Check what getElementById returns, no flushing
70     is(getCont(), node, "Should be getting clone pre-flush");
71     
72     // Trigger a layout flush, just in case.
73     var itemHeight = newParent.offsetHeight/10;
75     // Check what getElementById returns now.
76     is(getCont(), node, "Should be getting clone post-flush");
78   }
80   function clear(node) {
81     while (node.hasChildNodes()) {
82       node.removeChild(node.firstChild);
83     }
84   }
86   addLoadEvent(testClone);
87   addLoadEvent(SimpleTest.finish);
88 ]]>
89 </script>
90 <p id="display"></p>
91 <div id="content" style="display: none">
92   <script class="testbody" type="text/javascript">
93   <![CDATA[
94     testNode = fun.call(document, "content");
95     // Needs incremental XML parser
96     isnot(testNode, null, "Should have node here");
97   ]]>
98   </script>  
99 </div>
100 <pre id="test">
101 </pre>
102 </body>
103 </html>