From: tbrannon Date: Fri, 9 Jan 2009 19:00:24 +0000 (-0500) Subject: passover method implemented X-Git-Tag: 5.200_001~48 X-Git-Url: http://git.ieval.ro/?p=html-element-library.git;a=commitdiff_plain;h=de64e3d92123bc55a18ce3829f9c95af6e51e994 passover method implemented --- diff --git a/lib/HTML/Element/Library.pm b/lib/HTML/Element/Library.pm index 8f888b5..523c211 100644 --- a/lib/HTML/Element/Library.pm +++ b/lib/HTML/Element/Library.pm @@ -24,7 +24,7 @@ our @EXPORT = qw(); -our $VERSION = '3.51'; +our $VERSION = '3.53'; # Preloaded methods go here. @@ -36,6 +36,33 @@ sub HTML::Element::siblings { $p->content_list; } +sub HTML::Element::passover { + my ($tree, $child_id) = @_; + + #warn "ARGS: my ($tree, $child)"; + + my $exodus = $tree->look_down(id => $child_id); + + my @s = HTML::Element::siblings($exodus); + + warn "sibling count", scalar @s; + warn "siblings", join ':', @s; + + for my $s (@s) { + warn "SIBLING: $s"; + warn "ref sib", ref $s; + next unless ref $s; + if ($s->attr('id') eq $child_id) { + ; + } else { + $s->delete; + } + } + + return $exodus; # Goodbye Egypt! http://en.wikipedia.org/wiki/Passover + +} + sub HTML::Element::sibdex { my $element = shift;