3 <script src=
"../../resources/js-test.js"></script>
7 <STRONG>strong
</STRONG><strong>strong
</strong><FOO>FOO
</FOO><foo>foo
</foo>
9 <div id=
"console"></div>
10 <script type=
"text/javascript">
12 function testHTML(query
, expectedCount
)
14 res
= document
.evaluate(query
, document
, function() { return "http://www.w3.org/1999/xhtml" }, XPathResult
.UNORDERED_NODE_SNAPSHOT_TYPE
, null);
15 debug("HTML " + query
);
16 shouldBe('res.snapshotLength', expectedCount
);
19 function testXML(query
, expectedCount
)
21 res
= doc
.evaluate(query
, doc
, function() { return "http://www.w3.org/1999/xhtml" }, XPathResult
.UNORDERED_NODE_SNAPSHOT_TYPE
, null);
22 debug("XML " + query
);
23 shouldBe('res.snapshotLength', expectedCount
);
26 testHTML('//*[@id="sometext"]//strong', '2');
27 testHTML('//*[@id="sometext"]//Strong', '2');
28 testHTML('//*[@id="Sometext"]//strong', '0');
29 testHTML('//*[@id="sometext"]//foo', '2');
30 testHTML('//*[@id="sometext"]//FOO', '2');
32 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');
34 testXML('//*[@id="sometext"]//x:strong', '1');
35 testXML('//*[@id="sometext"]//x:Strong', '0');
36 testXML('//*[@id="Sometext"]//x:strong', '0');
37 testXML('//*[@id="sometext"]//foo', '1');
38 testXML('//*[@id="sometext"]//FOO', '1');