summaryrefslogtreecommitdiffstats
path: root/dom/base/test/test_w3element_traversal.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/base/test/test_w3element_traversal.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/base/test/test_w3element_traversal.html')
-rw-r--r--dom/base/test/test_w3element_traversal.html148
1 files changed, 148 insertions, 0 deletions
diff --git a/dom/base/test/test_w3element_traversal.html b/dom/base/test/test_w3element_traversal.html
new file mode 100644
index 000000000..fdd4ac03c
--- /dev/null
+++ b/dom/base/test/test_w3element_traversal.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+-->
+<head>
+ <title>W3 Tests for Element Traversal - HTML</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+
+ <p id="parentEl_count">
+ <span id="first_element_child_count">
+ <span></span>
+ <span></span>
+ </span>
+ <span id="middle_element_child_count"></span>
+ <span id="last_element_child_count"></span>
+ </p>
+
+
+ <p id="parentEl_nochild">
+ </p>
+
+ <p id="parentEl_null">
+ </p>
+
+ <p id="parentEl_dynamicadd">
+ <span id="first_emement_child_add"></span>
+ </p>
+
+ <p id="parentEl_dynamicremove">
+ <span id="first_emement_child_remove"></span>
+ <span id="last_emement_child_remove"></span>
+ </p>
+
+
+ <p id="parentEl_fec">
+ <span id="first_element_child_fec"></span>
+ </p>
+
+ <p id="parentEl_lec">
+ <span id="first_element_child_lec"></span>
+ <span id="last_element_child_lec"></span>
+ </p>
+
+ <p id="parentEl_namespace">
+ <pickle:span id="first_element_child_namespace"></pickle:span>
+ </p>
+
+ <p id="parentEl_nes">
+ <span id="first_element_child_nes"></span>
+ <span id="last_element_child_nes"></span>
+ </p>
+
+ <p id="parentEl_pes">
+ <span id="first_element_child_pes"></span>
+ <span id="middle_element_child_pes"></span>
+ <span id="last_element_child_pes"></span>
+ </p>
+
+ <p id="parentEl_sibnull">
+ <span id="first_element_child_sibnull"></span>
+ </p>
+
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+
+
+function runTest() {
+
+ //from et-childElementCount.html
+ var parentEl = document.getElementById("parentEl_count");
+ is(parentEl.childElementCount && 3, parentEl.childElementCount, "Child Element Count is mismatched");
+
+ //from et-childElementCount-nochild.html
+ var parentEl_nochild = document.getElementById("parentEl_nochild");
+ is(parentEl_nochild.childElementCount, 0, "Child Element count is not 0");
+
+ //from et-childElementCount-null.html
+ parentEl = document.getElementById("parentEl_null");
+ is(null == parentEl.firstElementChild, null == parentEl.lastElementChild, "firstElementChild or lastElementChild is not null");
+
+ //from et-dynamic-add.html
+ parentEl = document.getElementById("parentEl_dynamicadd");
+ var newChild = document.createElement("span")
+ parentEl.appendChild( newChild );
+ is(parentEl.childElementCount && 2, parentEl.childElementCount, "failed to add span element");
+
+ //from et-dynamic-remove.html
+ parentEl = document.getElementById("parentEl_dynamicremove");
+ var lec = parentEl.lastElementChild;
+ parentEl.removeChild( lec );
+ is(parentEl.childElementCount && 1, parentEl.childElementCount, "failed to remove span element");
+
+ //from et-firstElementChild.html
+ parentEl = document.getElementById("parentEl_fec");
+ var fec = parentEl.firstElementChild;
+ is(fec.nodeType, 1, "failed to get firstElementChild");
+ is(fec.getAttribute("id"), "first_element_child_fec", "failed to get firstElementChild");
+ isnot(fec, null, "failed to get firstElementChild");
+
+ //from et-lastElementChild.html
+ parentEl = document.getElementById("parentEl_lec");
+ var lec = parentEl.lastElementChild;
+ is(lec.nodeType, 1, "failed to get lastElementChild");
+ is(lec.getAttribute("id"), "last_element_child_lec", "failed to get lastElementChild");
+ isnot(lec, null, "failed to get lastElementChild");
+
+ //from et-namespace.html
+ parentEl = document.getElementById("parentEl_namespace");
+ var fec = parentEl.firstElementChild;
+ isnot(fec, null, "failed to get firstElementChild in namespace");
+ is(fec.getAttribute("id"), "first_element_child_namespace", "failed to get firstElementChild in namespace");
+
+ //from et-nextElementSibling.html
+ parentEl = document.getElementById("parentEl_nes");
+ var fec = parentEl.firstElementChild;
+ var nes = fec.nextElementSibling;
+ is(nes.nodeType, 1, "failed to get nextElementSibling");
+ is(nes.getAttribute("id"), "last_element_child_nes", "failed to get nextElementSibling");
+ isnot(nes, null, "failed to get nextElementSibling");
+
+ //from et-previousElementSibling.html
+ var lec = document.getElementById("last_element_child_pes");
+ var pes = lec.previousElementSibling;
+ is(pes.nodeType, 1, "failed to get previousElementSibling");
+ is(pes.getAttribute("id"), "middle_element_child_pes", "failed to get previousElementSibling");
+ isnot(pes, null, "failed to get previousElementSibling");
+
+ //from et-siblingElement-null.html
+ var fec = document.getElementById("first_element_child_sibnull");
+ var pes = fec.previousElementSibling;
+ var nes = fec.nextElementSibling;
+ is(pes, null, "got unexpected previousElementSibling");
+ is(nes, null, "got unexpected nextElementSibling");
+
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(runTest);
+addLoadEvent(SimpleTest.finish)
+</script>
+</pre>
+</body>
+</html>
+