diff -ur HTML-Tree-3.23/lib/HTML/Element.pm HTML-Tree-3.23-fix/lib/HTML/Element.pm --- HTML-Tree-3.23/lib/HTML/Element.pm 2006-11-13 03:13:33.000000000 +1000 +++ HTML-Tree-3.23-fix/lib/HTML/Element.pm 2009-09-23 14:22:12.000000000 +1000 @@ -2041,7 +2041,7 @@ and ref($this) # sanity and not( $this->{'_empty_element'} - || $empty_element_map->{$this->{'_tag'} || ''} + || ($empty_element_map->{$this->{'_tag'} || ''} && !@{$this->{'_content'}}) ) # things that don't get post-order callbacks ) { shift @I;