Skip to content

Commit

Permalink
Check which node is returned in the xml_xpath_tests.xml test data (we…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsnedders authored Nov 24, 2016
1 parent 08b5ff1 commit 374f5e3
Show file tree
Hide file tree
Showing 2 changed files with 5,127 additions and 0 deletions.
7 changes: 7 additions & 0 deletions domxpath/xml_xpath_runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
/* note this func adopts the tree! */
var new_doc = document.implementation.createDocument("", "");
var xpath = find_child_element(test_el, "xpath");
var result = find_child_element(test_el, "result");
var namespace = find_child_element(result, "namespace");
var localname = find_child_element(result, "localname");
var nth = find_child_element(result, "nth");
var tree = find_child_element(test_el, "tree");
var actual_tree = new_doc.adoptNode(tree.firstElementChild);
new_doc.appendChild(actual_tree);
Expand All @@ -32,6 +36,9 @@
matched.push(cur);
}
assert_equals(matched.length, 1, "Should match one node");
var similar = new_doc.getElementsByTagNameNS(namespace.textContent,
localname.textContent);
assert_equals(matched[0], similar[nth.textContent]);
});
}

Expand Down
Loading

0 comments on commit 374f5e3

Please sign in to comment.