}\n"; $html1 = ''; $dom1 = DomWrapper::fromString($html1); echo "Parsed as: " . $dom1->document->saveHTML() . "\n\n"; // Test 2: Explicit closing tag echo "Test 2: Explicit closing tag \n"; $html2 = ''; $dom2 = DomWrapper::fromString($html2); echo "Parsed as: " . $dom2->document->saveHTML() . "\n\n"; // Test 3: Multiple self-closing tags echo "Test 3: Multiple self-closing tags\n"; $html3 = '

Before

After

'; $dom3 = DomWrapper::fromString($html3); echo "Parsed as: " . $dom3->document->saveHTML() . "\n\n"; // Test 4: Check if elements are actually siblings echo "Test 4: Check element relationships\n"; $body = $dom3->document->body; if ($body) { echo "Body children count: " . $body->childNodes->length . "\n"; foreach ($body->childNodes as $i => $child) { if ($child instanceof \Dom\Element) { echo " Child #{$i}: {$child->tagName}\n"; } } }