dom/bindings/test/test_cloneAndImportNode.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/bindings/test/test_cloneAndImportNode.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=882541
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 882541</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <script type="application/javascript">
    1.15 +
    1.16 +  /** Test for Bug 882541 **/
    1.17 +  var div = document.createElement("div");
    1.18 +  div.appendChild(document.createElement("span"));
    1.19 +
    1.20 +  var div2;
    1.21 +
    1.22 +  div2 = div.cloneNode();
    1.23 +  is(div2.childNodes.length, 0, "cloneNode() should do a shallow clone");
    1.24 +
    1.25 +  div2 = div.cloneNode(undefined);
    1.26 +  is(div2.childNodes.length, 0, "cloneNode(undefined) should do a shallow clone");
    1.27 +
    1.28 +  div2 = div.cloneNode(true);
    1.29 +  is(div2.childNodes.length, 1, "cloneNode(true) should do a deep clone");
    1.30 +
    1.31 +  div2 = document.importNode(div);
    1.32 +  is(div2.childNodes.length, 0, "importNode(node) should do a deep import");
    1.33 +
    1.34 +  div2 = document.importNode(div, undefined);
    1.35 +  is(div2.childNodes.length, 0, "importNode(undefined) should do a shallow import");
    1.36 +
    1.37 +  div2 = document.importNode(div, true);
    1.38 +  is(div2.childNodes.length, 1, "importNode(true) should do a deep import");
    1.39 +
    1.40 +  </script>
    1.41 +</head>
    1.42 +<body>
    1.43 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=882541">Mozilla Bug 882541</a>
    1.44 +<p id="display"></p>
    1.45 +<div id="content" style="display: none">
    1.46 +
    1.47 +</div>
    1.48 +<pre id="test">
    1.49 +</pre>
    1.50 +</body>
    1.51 +</html>

mercurial