Skip to content

Commit

Permalink
fixed additional bug in RT#31664, copy did not copy the empty status …
Browse files Browse the repository at this point in the history
…of elements
  • Loading branch information
mirod committed May 18, 2010
1 parent 85d0dcb commit 42137b8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Changes
Expand Up @@ -7,6 +7,11 @@ date:
# minor maintenance release
added: can use the tag[nested] form in twig handlers that
triggers on elements 'tag' that include a child 'nested'
fixed: copy did not copy the empty status of an element
RT#31664 spotted by Roland Minner
https://rt.cpan.org/Ticket/Display.html?id=31664



version: 3.35
date: 2010-05-15
Expand Down
2 changes: 2 additions & 0 deletions Twig_pm.slow
Expand Up @@ -7347,6 +7347,8 @@ sub copy
if( $XML::Twig::weakrefs) { weaken( $copy->{former}->{$link}); }
}

$copy->set_empty( $elt->is_empty);

return $copy;
}

Expand Down
11 changes: 10 additions & 1 deletion t/test_3_36.t
Expand Up @@ -12,7 +12,7 @@ my $DEBUG=0;

use XML::Twig;

my $TMAX=1;
my $TMAX=2;
print "1..$TMAX\n";

{ my $doc=q{<d><s id="s1"><t>title 1</t><s id="s2"><t>title 2</t></s><s id="s3"></s></s><s id="s4"></s></d>};
Expand All @@ -21,4 +21,13 @@ print "1..$TMAX\n";
is( $ids, 's2s1', 's[t]');
}

{
my $string = q{<foo>power<baz/><bar></bar></foo>};
my $t=XML::Twig->parse( $string);
my $root = $t->root();
my $copy = $root->copy();
is( $copy->sprint, $root->sprint, 'empty elements in a copy')

}

1;

0 comments on commit 42137b8

Please sign in to comment.