1 <html xmlns=
"http://www.w3.org/1999/xhtml">
3 https://bugzilla.mozilla.org/show_bug.cgi?id=311681
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" />
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">
16 SimpleTest.waitForExplicitFinish();
18 // Make sure to trigger the hashtable case by asking for enough elements
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"
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
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");
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);
92 <div id=
"content" style=
"display: none">
93 <script class=
"testbody" type=
"text/javascript">
95 testNode = fun.call(document,
"content");
96 // Needs incremental XML parser
97 todo(testNode != null,
"Should have node here");