From de64e3d92123bc55a18ce3829f9c95af6e51e994 Mon Sep 17 00:00:00 2001 From: tbrannon Date: Fri, 9 Jan 2009 14:00:24 -0500 Subject: [PATCH] passover method implemented --- lib/HTML/Element/Library.pm | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) 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; -- 2.39.2