<html> <head> <link rel="stylesheet" href="../js/resources/js-test-style.css"> <script src="../js/resources/js-test-pre.js"></script> </head> <body> <p id="sometext"> <STRONG>strong</STRONG><strong>strong</strong><FOO>FOO</FOO><foo>foo</foo> </p> <div id="console"></div> <script type="text/javascript"> function testHTML(query, expectedCount) { res = document.evaluate(query, document, function() { return "http://www.w3.org/1999/xhtml" }, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); debug("HTML " + query); shouldBe('res.snapshotLength', expectedCount); } function testXML(query, expectedCount) { res = doc.evaluate(query, doc, function() { return "http://www.w3.org/1999/xhtml" }, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); debug("XML " + query); shouldBe('res.snapshotLength', expectedCount); } testHTML('//*[@id="sometext"]//strong', '2'); testHTML('//*[@id="sometext"]//Strong', '2'); testHTML('//*[@id="Sometext"]//strong', '0'); testHTML('//*[@id="sometext"]//foo', '2'); testHTML('//*[@id="sometext"]//FOO', '2'); var doc = (new DOMParser).parseFromString('<p id="sometext" xmlns="http://www.w3.org/1999/xhtml"><STRONG>strong</STRONG><strong>strong</strong><FOO xmlns="">FOO</FOO><foo xmlns="">foo</foo></p>', 'application/xhtml+xml'); testXML('//*[@id="sometext"]//x:strong', '1'); testXML('//*[@id="sometext"]//x:Strong', '0'); testXML('//*[@id="Sometext"]//x:strong', '0'); testXML('//*[@id="sometext"]//foo', '1'); testXML('//*[@id="sometext"]//FOO', '1'); var successfullyParsed = true; </script> <script src="../js/resources/js-test-post.js"></script> </body> </html>