1--TEST-- 2DOMNode::isConnected and DOMNameSpaceNode::isConnected 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = new DOMDocument(); 9$dom->loadXML('<!DOCTYPE html><html><head/><body/></html>'); 10 11$docElement = $dom->documentElement; 12$head = $docElement->firstChild; 13$body = $head->nextSibling; 14 15echo "--- Created element not connected yet ---\n"; 16 17$p = $dom->createElement('p'); 18var_dump($p->isConnected); 19 20echo "--- Appending and checking connection isn't broken for parents ---\n"; 21 22$body->appendChild($p); 23var_dump($body->isConnected); 24var_dump($p->isConnected); 25$document = $docElement->parentNode; 26var_dump($document->isConnected); 27var_dump($dom->doctype->isConnected); 28 29echo "--- Indirect removal should set isConnected to false for affected nodes ---\n"; 30 31$body->remove(); 32var_dump($p->isConnected); 33var_dump($docElement->isConnected); 34var_dump($body->isConnected); 35var_dump($head->isConnected); 36var_dump($dom->doctype->isConnected); 37 38echo "--- Empty document test ---\n"; 39 40$dom = new DOMDocument(); 41var_dump($dom->isConnected); 42 43?> 44--EXPECT-- 45--- Created element not connected yet --- 46bool(false) 47--- Appending and checking connection isn't broken for parents --- 48bool(true) 49bool(true) 50bool(true) 51bool(true) 52--- Indirect removal should set isConnected to false for affected nodes --- 53bool(false) 54bool(true) 55bool(false) 56bool(true) 57bool(true) 58--- Empty document test --- 59bool(true) 60