diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/base/test/test_w3element_traversal.xhtml | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/test/test_w3element_traversal.xhtml')
-rw-r--r-- | dom/base/test/test_w3element_traversal.xhtml | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/dom/base/test/test_w3element_traversal.xhtml b/dom/base/test/test_w3element_traversal.xhtml new file mode 100644 index 0000000000..334d184304 --- /dev/null +++ b/dom/base/test/test_w3element_traversal.xhtml @@ -0,0 +1,149 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:pickle="http://ns.example.org/pickle" lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <title>W3 Tests for Element Traversal - XHTML</title> + <script 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> + + <div id="parentEl_namespace"> + <pickle:dill /> + </div> + + <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"><![CDATA[ + + + +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 nChild = parentEl.firstElementChild; + is(nChild && "dill", nChild.localName, "failed to get a namespace element"); + + + //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> + |