1--TEST--
2Element::removeAttributeNS()
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8function createFreshBody() {
9    $dom = Dom\HTMLDocument::createFromString('<!DOCTYPE html><html><body align="foo" foo:bar="baz"></body></html>');
10    $body = $dom->getElementsByTagName("body")[0];
11    return $body;
12}
13
14echo "--- After parsing, i.e. without namespace ---\n";
15
16$body = createFreshBody();
17$body->removeAttributeNS(NULL, "align");
18echo $body->ownerDocument->saveHtml($body), "\n";
19
20$body = createFreshBody();
21$body->removeAttributeNS("", "align");
22echo $body->ownerDocument->saveHtml($body), "\n";
23
24$body = createFreshBody();
25$body->removeAttributeNS(NULL, "ALIGN");
26echo $body->ownerDocument->saveHtml($body), "\n";
27
28$body = createFreshBody();
29$body->removeAttributeNS("", "ALIGN");
30echo $body->ownerDocument->saveHtml($body), "\n";
31
32$body = createFreshBody();
33$body->removeAttributeNS(NULL, "foo:bar");
34echo $body->ownerDocument->saveHtml($body), "\n";
35
36$body = createFreshBody();
37$body->removeAttributeNS("", "foo:bar");
38echo $body->ownerDocument->saveHtml($body), "\n";
39
40$body = createFreshBody();
41$body->removeAttributeNS(NULL, "FOO:BAR");
42echo $body->ownerDocument->saveHtml($body), "\n";
43
44$body = createFreshBody();
45$body->removeAttributeNS("", "FOO:BAR");
46echo $body->ownerDocument->saveHtml($body), "\n";
47
48echo "--- Special legacy case ---\n";
49
50$body = createFreshBody();
51$body->ownerDocument->documentElement->removeAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns");
52
53echo "--- Remove after creating without namespace ---\n";
54
55$body = createFreshBody();
56$body->setAttributeNode($attr = $body->ownerDocument->createAttribute("prefix:local"));
57$attr->value = "A";
58echo $body->ownerDocument->saveHtml($body), "\n";
59$body->removeAttributeNS(NULL, "prefix:LOCAL");
60echo $body->ownerDocument->saveHtml($body), "\n";
61$body->removeAttributeNS(NULL, "prefix:local");
62echo $body->ownerDocument->saveHtml($body), "\n";
63
64echo "--- Remove after creating with namespace ---\n";
65
66$body = createFreshBody();
67$body->setAttributeNode($attr = $body->ownerDocument->createAttributeNS("urn:a", "prefix:local2"));
68$attr->value = "B";
69echo $body->ownerDocument->saveHtml($body), "\n";
70$body->removeAttributeNS("urn:a", "LOCAL2");
71echo $body->ownerDocument->saveHtml($body), "\n";
72$body->removeAttributeNS("urn:a", "local2");
73echo $body->ownerDocument->saveHtml($body), "\n";
74
75?>
76--EXPECT--
77--- After parsing, i.e. without namespace ---
78<body foo:bar="baz"></body>
79<body foo:bar="baz"></body>
80<body align="foo" foo:bar="baz"></body>
81<body align="foo" foo:bar="baz"></body>
82<body align="foo"></body>
83<body align="foo"></body>
84<body align="foo" foo:bar="baz"></body>
85<body align="foo" foo:bar="baz"></body>
86--- Special legacy case ---
87--- Remove after creating without namespace ---
88<body align="foo" foo:bar="baz" prefix:local="A"></body>
89<body align="foo" foo:bar="baz" prefix:local="A"></body>
90<body align="foo" foo:bar="baz"></body>
91--- Remove after creating with namespace ---
92<body align="foo" foo:bar="baz" prefix:local2="B"></body>
93<body align="foo" foo:bar="baz" prefix:local2="B"></body>
94<body align="foo" foo:bar="baz"></body>
95