1--TEST--
2HTMLDocument::getElementsByTagName
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8require __DIR__ . "/node_list_dump.inc";
9require __DIR__ . "/create_element_util.inc";
10
11$dom = DOM\HTMLDocument::createEmpty();
12$container = $dom->appendChild(createElement($dom, "container"));
13$container->appendChild(createElement($dom, "HTML", "1"));
14$container->appendChild(createElementNS($dom, "http://www.w3.org/1999/xhtml", "html", "2"));
15$container->appendChild(createElementNS($dom, NULL, "html", "3"));
16$container->appendChild(createElementNS($dom, NULL, "HTML", "4"));
17$container->appendChild(createElementNS($dom, "urn:foo", "htML", "5"));
18$container->appendChild(createElement($dom, "foo:HTML", "6"));
19$container->appendChild(createElementNS($dom, "urn:a", "foo:HTML", "7")); // Should never match in this test file
20$container->appendChild(createElementNS($dom, "http://www.w3.org/1999/xhtml", "bar:HTML", "8"));
21$container->appendChild(createElementNS($dom, "http://www.w3.org/1999/xhtml", "bar:html", "9"));
22
23dumpNodeList($dom->getElementsByTagName("HTml"));
24dumpNodeList($dom->getElementsByTagName("htML"));
25dumpNodeList($dom->getElementsByTagName("html"));
26dumpNodeList($dom->getElementsByTagName("HTML"));
27// Matches 6 instead of 7 because the input to this function is lowercased
28// _and_ createElement also lowercases.
29// This is in contrast to createElementNS that won't lowercase.
30dumpNodeList($dom->getElementsByTagName("foo:html"));
31// This will match both 6 and 7. 7 is now matched because the casing is right.
32dumpNodeList($dom->getElementsByTagName("foo:HTML"));
33// Both of the following calls will match 9 because 8 isn't lowercased due to the use of createElementNS.
34dumpNodeList($dom->getElementsByTagName("bar:HTML"));
35dumpNodeList($dom->getElementsByTagName("bar:html"));
36
37?>
38--EXPECT--
39Node list length: int(2)
40	HTML 1
41	HTML 2
42---
43Node list length: int(3)
44	HTML 1
45	HTML 2
46	htML 5
47---
48Node list length: int(3)
49	HTML 1
50	HTML 2
51	html 3
52---
53Node list length: int(3)
54	HTML 1
55	HTML 2
56	HTML 4
57---
58Node list length: int(1)
59	FOO:HTML 6
60---
61Node list length: int(2)
62	FOO:HTML 6
63	foo:HTML 7
64---
65Node list length: int(1)
66	BAR:HTML 9
67---
68Node list length: int(1)
69	BAR:HTML 9
70---
71