1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=882541
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 882541</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 882541 **/
var div = document.createElement("div");
div.appendChild(document.createElement("span"));
var div2;
div2 = div.cloneNode();
is(div2.childNodes.length, 0, "cloneNode() should do a shallow clone");
div2 = div.cloneNode(undefined);
is(div2.childNodes.length, 0, "cloneNode(undefined) should do a shallow clone");
div2 = div.cloneNode(true);
is(div2.childNodes.length, 1, "cloneNode(true) should do a deep clone");
div2 = document.importNode(div);
is(div2.childNodes.length, 0, "importNode(node) should do a deep import");
div2 = document.importNode(div, undefined);
is(div2.childNodes.length, 0, "importNode(undefined) should do a shallow import");
div2 = document.importNode(div, true);
is(div2.childNodes.length, 1, "importNode(true) should do a deep import");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=882541">Mozilla Bug 882541</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>
|