1--TEST-- 2Test Dom\Document::$head 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8echo "--- From parsing ---\n"; 9 10$dom = Dom\HTMLDocument::createFromString("<p>foo</p>", LIBXML_NOERROR); 11var_dump($dom->head?->nodeName); 12 13echo "--- After head removal ---\n"; 14 15$dom->head->remove(); 16var_dump($dom->head?->nodeName); 17 18echo "--- head in no namespace ---\n"; 19 20$tmp = $dom->documentElement->appendChild($dom->createElementNS("", "head")); 21var_dump($dom->head?->nodeName); 22$tmp->remove(); 23 24echo "--- head in right namespace ---\n"; 25 26$tmp = $dom->documentElement->appendChild($dom->createElementNS("http://www.w3.org/1999/xhtml", "head")); 27var_dump($dom->head?->nodeName); 28$tmp->remove(); 29 30echo "--- prefixed head in right namespace ---\n"; 31 32$tmp = $dom->documentElement->appendChild($dom->createElementNS("http://www.w3.org/1999/xhtml", "prefix:head")); 33var_dump($dom->head?->nodeName); 34$tmp->remove(); 35 36echo "--- multiple head elements in right namespace ---\n"; 37 38$tmp1 = $dom->documentElement->appendChild($dom->createElementNS("http://www.w3.org/1999/xhtml", "prefix1:head")); 39var_dump($dom->head?->nodeName); 40$tmp2 = $dom->documentElement->appendChild($dom->createElementNS("http://www.w3.org/1999/xhtml", "prefix2:head")); 41var_dump($dom->head?->nodeName); 42$tmp1->remove(); 43var_dump($dom->head?->nodeName); 44$tmp2->remove(); 45var_dump($dom->head?->nodeName); 46 47echo "--- html element in no namespace ---\n"; 48 49$dom = Dom\XMLDocument::createFromString(<<<XML 50<html xmlns=""> 51 <head/> 52</html> 53XML); 54var_dump($dom->head); 55 56?> 57--EXPECT-- 58--- From parsing --- 59string(4) "HEAD" 60--- After head removal --- 61NULL 62--- head in no namespace --- 63NULL 64--- head in right namespace --- 65string(4) "HEAD" 66--- prefixed head in right namespace --- 67string(11) "PREFIX:HEAD" 68--- multiple head elements in right namespace --- 69string(12) "PREFIX1:HEAD" 70string(12) "PREFIX1:HEAD" 71string(12) "PREFIX2:HEAD" 72NULL 73--- html element in no namespace --- 74NULL 75