chromium/third_party/blink/web_tests/fast/xpath/xpath-detached-import-assert.html

<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<svg id="svg"></svg>
<p>A test case from https://bugs.webkit.org/show_bug.cgi?id=84793.
<p>Test passes if it doesn't hit ASSERT(parents.size() &gt;= depth + 1).
<div id="console"></div>

<script>
  resolver = function (prefix) {
    var ns = {
      "svg"    : "http://www.w3.org/2000/svg",
      "xhtml"  : "http://www.w3.org/1999/xhtml",
    };
    return ns[prefix] || null;
  }

  var result= document.evaluate("/node()/descendant-or-self::svg:* | node()/ancestor-or-self::node()", document.getElementById("svg").ownerDocument.importNode(document.documentElement), resolver, XPathResult.NUMBER_TYPE, result);
  shouldBe("result.numberValue", "NaN");
</script>
</body>
</html>