summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/traversal/traversal-support.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/dom/traversal/traversal-support.js')
-rw-r--r--testing/web-platform/tests/dom/traversal/traversal-support.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/traversal/traversal-support.js b/testing/web-platform/tests/dom/traversal/traversal-support.js
new file mode 100644
index 000000000..0d5d8ad74
--- /dev/null
+++ b/testing/web-platform/tests/dom/traversal/traversal-support.js
@@ -0,0 +1,10 @@
+// |expected| should be an object indicating the expected type of node.
+function assert_node(actual, expected)
+{
+ assert_true(actual instanceof expected.type,
+ 'Node type mismatch: actual = ' + actual.nodeType + ', expected = ' + expected.nodeType);
+ if (typeof(expected.id) !== 'undefined')
+ assert_equals(actual.id, expected.id);
+ if (typeof(expected.nodeValue) !== 'undefined')
+ assert_equals(actual.nodeValue, expected.nodeValue);
+}