summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/traversal/unfinished/010.xml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/dom/traversal/unfinished/010.xml
parentInitial commit. (diff)
downloadfirefox-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/010.xml')
-rw-r--r--testing/web-platform/tests/dom/traversal/unfinished/010.xml64
1 files changed, 64 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/traversal/unfinished/010.xml b/testing/web-platform/tests/dom/traversal/unfinished/010.xml
new file mode 100644
index 0000000000..63263a5fd7
--- /dev/null
+++ b/testing/web-platform/tests/dom/traversal/unfinished/010.xml
@@ -0,0 +1,64 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>DOM Traversal: NodeIterator: Filters</title>
+ <script type="text/javascript"> <![CDATA[
+ function doTest() {
+ var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, testFilter, false);
+ // skips text nodes and body element
+ var expected = new Array(9, // document
+ 1, // html
+ 1, // head
+ 1, // title
+ 1, 4, // script and CDATA block
+ // body (skipped)
+ 1, // pre
+ // </body>
+ 8, // <!-- -->
+ // PI skipped
+ 4); // CDATA
+ var found = new Array();
+
+ // walk document
+ var node;
+ while (node = iterator.nextNode())
+ found.push(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';
+ }
+
+ function testFilter(n) {
+ if (n.nodeType == 3) {
+ return NodeFilter.FILTER_SKIP;
+ } else if (n.nodeName == 'body') {
+ return NodeFilter.FILTER_REJECT; // same as _SKIP
+ }
+ return 1; // FILTER_ACCEPT
+ }
+
+ ]]></script>
+ </head>
+ <body onload="doTest()">
+ <pre id="result">FAIL: Script failed to run.</pre>
+ </body>
+ <!-- some more nodes to test this: -->
+ <?body test?>
+ <![CDATA[]]>
+</html> \ No newline at end of file