diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/dom/traversal/unfinished/002.xml | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/dom/traversal/unfinished/002.xml')
-rw-r--r-- | testing/web-platform/tests/dom/traversal/unfinished/002.xml | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/traversal/unfinished/002.xml b/testing/web-platform/tests/dom/traversal/unfinished/002.xml new file mode 100644 index 0000000000..bf3489688c --- /dev/null +++ b/testing/web-platform/tests/dom/traversal/unfinished/002.xml @@ -0,0 +1,54 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>DOM Traversal: NodeIterator: Basics Backwards</title> + <script type="text/javascript"> <![CDATA[ + function doTest() { + var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, null, false); + var expected = new Array(9, // document + 1, // html + 3, 1, // head + 3, 1, 3, // title + 3, 1, 3, 4, // script and CDATA block + 3, 3, 1, // body + 3, 1, 3, // pre + 3, // </body> + 3, 8, // <!-- --> + 3, 7, // <? ?>, + 3, 4, 3); // CDATA + var found = new Array(); + + // walk document + var node; + while (node = iterator.nextNode()); + while (node = iterator.previousNode()) + found.unshift(node.nodeType); + + // check results + var errors = 0; + var s = ''; + var length = (found.length > expected.length) ? found.length : expected.length; + s += 'EXPECTED FOUND\n'; + for (var i = 0; i < length; i += 1) { + s += ' ' + (expected[i] ? expected[i] : '-') + + ' ' + (found[i] ? found[i] : '-'); + if (found[i] != expected[i]) { + s += ' MISMATCH'; + errors += 1; + } + s += '\n'; + } + var p = document.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'pre')[0]; + if (errors) + p.firstChild.data = 'FAIL: ' + errors + ' errors found:\n\n' + s; + else + p.firstChild.data = 'PASS'; + } + ]]></script> + </head> + <body onload="doTest()"> + <pre id="result">FAIL: Script failed to run.</pre> + </body> + <!-- some more nodes to test this: --> + <?test node?> + <![CDATA[]]> +</html>
\ No newline at end of file |