content/base/test/test_bug895974.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug895974.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,69 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=895974
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 895974</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 895974 **/
    1.17 +  SimpleTest.waitForExplicitFinish();
    1.18 +
    1.19 +  addLoadEvent(function() {
    1.20 +  var frag = document.createDocumentFragment();
    1.21 +  var span = document.createElement("span");
    1.22 +  var div = document.createElement("div");
    1.23 +  var text = document.createTextNode("help");
    1.24 +  frag.appendChild(document.createTextNode("fail"));
    1.25 +  frag.appendChild(span);
    1.26 +  frag.appendChild(text);
    1.27 +  frag.appendChild(div);
    1.28 +  frag.appendChild(document.createTextNode("fail"));
    1.29 +
    1.30 +  is(text.nextElementSibling, div, "nextElementSibling should work on text");
    1.31 +  is(text.previousElementSibling, span,
    1.32 +    "previousElementSibling should work on text");
    1.33 +
    1.34 +  is(document.firstElementChild, document.documentElement,
    1.35 +     "firstElementChild should work on document");
    1.36 +  is(document.lastElementChild, document.documentElement,
    1.37 +     "lastElementChild should work on document");
    1.38 +  is(document.children.length, 1, "Document has one element kid");
    1.39 +  is(document.children[0], document.documentElement,
    1.40 +     "Document only element child is <html>");
    1.41 +
    1.42 +  is(frag.firstElementChild, span,
    1.43 +     "firstElementChild should work on document fragment");
    1.44 +  is(frag.lastElementChild, div,
    1.45 +     "lastElementChild should work on document fragment");
    1.46 +  is(frag.children.length, 2, "Document fragment has two element kids");
    1.47 +  is(frag.children[0], span, "Document fragment first element child is span");
    1.48 +  is(frag.children[1], div, "Document fragment second element child is div");
    1.49 +
    1.50 +  is(document.documentElement.firstElementChild, document.head,
    1.51 +     "firstElementChild should work on element");
    1.52 +  is(document.documentElement.lastElementChild, document.body,
    1.53 +     "lastElementChild should work on element");
    1.54 +  is(document.documentElement.children.length, 2, "<html> has two element kids");
    1.55 +  is(document.documentElement.children[0], document.head,
    1.56 +     "<html> first element child is head");
    1.57 +  is(document.documentElement.children[1], document.body,
    1.58 +     "<html>  second element child is body");
    1.59 +  SimpleTest.finish();
    1.60 +  });
    1.61 +  </script>
    1.62 +</head>
    1.63 +<body>
    1.64 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=895974">Mozilla Bug 895974</a>
    1.65 +<p id="display"></p>
    1.66 +<div id="content" style="display: none">
    1.67 +
    1.68 +</div>
    1.69 +<pre id="test">
    1.70 +</pre>
    1.71 +</body>
    1.72 +</html>

mercurial