Subject: | HTML::Element::replace_with does not set $_->{'_parent'} |
Date: | Tue, 28 Apr 2009 05:44:40 +0900 (JST) |
To: | bug-html-tree [...] rt.cpan.org |
From: | Y.Ishiyama <ishiyosi [...] rose.odn.ne.jp> |
I am glad.
Because the chance when it was able to contribute was obtained.
Of course, I am using the HTML-Tree-3.23.
#!/usr/bin/perl
use HTML::TreeBuilder;
$root = HTML::TreeBuilder->new_from_content('<p><br/></p>');
$para = $root->find_by_tag_name('p');
print '$para=', $para, "\n";
$br = $para->find_by_tag_name('br');
print '$br->parent=', $br->parent, "\n"; # equal to $para
$br->replace_with(['br'])->delete;
$br = $para->find_by_tag_name('br'); # $para has $br. but
print '$br->parent=', $br->parent, "\n"; # $br has not parent
$br->delete; # deleted. but
print $root->as_HTML( undef,undef,{}); # not removed