diff options
Diffstat (limited to 'dom/base/test/test_bug895974.html')
-rw-r--r-- | dom/base/test/test_bug895974.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/dom/base/test/test_bug895974.html b/dom/base/test/test_bug895974.html new file mode 100644 index 000000000..25499d5a2 --- /dev/null +++ b/dom/base/test/test_bug895974.html @@ -0,0 +1,69 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=895974 +--> +<head> + <meta charset="utf-8"> + <title>Test for Bug 895974</title> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <script type="application/javascript"> + + /** Test for Bug 895974 **/ + SimpleTest.waitForExplicitFinish(); + + addLoadEvent(function() { + var frag = document.createDocumentFragment(); + var span = document.createElement("span"); + var div = document.createElement("div"); + var text = document.createTextNode("help"); + frag.appendChild(document.createTextNode("fail")); + frag.appendChild(span); + frag.appendChild(text); + frag.appendChild(div); + frag.appendChild(document.createTextNode("fail")); + + is(text.nextElementSibling, div, "nextElementSibling should work on text"); + is(text.previousElementSibling, span, + "previousElementSibling should work on text"); + + is(document.firstElementChild, document.documentElement, + "firstElementChild should work on document"); + is(document.lastElementChild, document.documentElement, + "lastElementChild should work on document"); + is(document.children.length, 1, "Document has one element kid"); + is(document.children[0], document.documentElement, + "Document only element child is <html>"); + + is(frag.firstElementChild, span, + "firstElementChild should work on document fragment"); + is(frag.lastElementChild, div, + "lastElementChild should work on document fragment"); + is(frag.children.length, 2, "Document fragment has two element kids"); + is(frag.children[0], span, "Document fragment first element child is span"); + is(frag.children[1], div, "Document fragment second element child is div"); + + is(document.documentElement.firstElementChild, document.head, + "firstElementChild should work on element"); + is(document.documentElement.lastElementChild, document.body, + "lastElementChild should work on element"); + is(document.documentElement.children.length, 2, "<html> has two element kids"); + is(document.documentElement.children[0], document.head, + "<html> first element child is head"); + is(document.documentElement.children[1], document.body, + "<html> second element child is body"); + SimpleTest.finish(); + }); + </script> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=895974">Mozilla Bug 895974</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +</pre> +</body> +</html> |