1--TEST-- 2Handling fragments of multiple nodes for DOMParentNode 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = new DOMDocument(); 9$dom->loadXML('<!DOCTYPE HTML><html><container/></html>'); 10 11$container = $dom->documentElement->firstElementChild; 12 13$fragment = $dom->createDocumentFragment(); 14$fragment->appendChild($dom->createElement('p', '1')); 15$fragment->appendChild($dom->createElement('b', '2')); 16$container->replaceWith($fragment); 17echo $dom->saveXML(); 18 19$dom->documentElement->append('foo'); 20echo $dom->saveXML(); 21 22$fragment = $dom->createDocumentFragment(); 23$fragment->appendChild($dom->createElement('p', '3')); 24$fragment->appendChild($dom->createElement('b', '4')); 25$dom->documentElement->prepend($fragment); 26echo $dom->saveXML(); 27 28?> 29--EXPECT-- 30<?xml version="1.0"?> 31<!DOCTYPE HTML> 32<html><p>1</p><b>2</b></html> 33<?xml version="1.0"?> 34<!DOCTYPE HTML> 35<html><p>1</p><b>2</b>foo</html> 36<?xml version="1.0"?> 37<!DOCTYPE HTML> 38<html><p>3</p><b>4</b><p>1</p><b>2</b>foo</html> 39