b=450088 backing out (new reftest failed)
[wine-gecko.git] / testing / mochitest / tests / test_bug311681.xhtml
blobd869cc3b3ba071be7b585ddf3dc0ec01c4d8b519
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);
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");
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(), testNode, "Should be getting orig node pre-flush 1");
48 // Trigger a layout flush, just in case.
49 var itemHeight = newParent.offsetHeight/10;
51 // Check what getElementById returns now.
52 is(getCont(), testNode, "Should be getting orig node post-flush 1");
54 clear(newParent);
56 // Check what getElementById returns, no flushing
57 is(getCont(), testNode, "Should be getting orig node pre-flush 2");
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");
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");
80 function clear(node) {
81 while (node.hasChildNodes()) {
82 node.removeChild(node.firstChild);
86 // Actually run the test once the XML parser works incrementally
87 // addLoadEvent(testClone);
88 addLoadEvent(SimpleTest.finish);
89 ]]>
90 </script>
91 <p id="display"></p>
92 <div id="content" style="display: none">
93 <script class="testbody" type="text/javascript">
94 <![CDATA[
95 testNode = fun.call(document, "content");
96 // Needs incremental XML parser
97 todo(testNode != null, "Should have node here");
98 ]]>
99 </script>
100 </div>
101 <pre id="test">
102 </pre>
103 </body>
104 </html>