<html>
<head>
<script>
    if (window.testRunner)
      testRunner.dumpAsText();

    var results = "";
    var result;
    var testNum = 1;
    function init() {
        var tests = [
            "id('nested1')",
            "id('nested1')/div[1]",
            "id('nested1')//div[1]",
            "id('nested1')/div[1]/input[2]",
            "id('nested1')/div[1]//input[2]",
            "id('nested1')//div[1]/input[2]",
            "id('nested1')//div[1]//input[2]"
        ];
        for (var i = 0; i < tests.length; i++) {
            runXPath(tests[i]);
        }
        document.getElementById('results').innerHTML = results;
    }
    
    function runXPath(xpath) {
        var result = document.evaluate(xpath, document, null, XPathResult.ANY_TYPE, null).iterateNext();
        results += xpath + " " + (result ? "PASSED" : "FAILED") + ": " + result + "<br />";
    }
</script>
</head>
<body onload="init()">
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=15380">bug 15380</a>:
XPath: id('foo') doesn't resolve correctly.</p>
<div id="nested1">
        <div id="nested2">
            <input id="nested3a" type="button" value="nested3a">
            <input id="nested3b" type="button" value="nested3b">
        </div>
    </div>
    <div id="results"></div>
</body>
</html>
