5 my $z = HTML::Zoom->from_html(<<'HTML');
8 <div id="foo"><p></p></div>
13 my @list = qw(foo bar baz);
14 my $iter = sub { shift @list };
16 my $actual = $z->select("#foo")->repeat(sub {
17 my $e = $iter->() or return;
19 $_->select("#foo")->set_attribute({name => 'id', value => $e})
20 ->select("p")->replace_content($e);
23 my $expected = <<'HTML';
26 <div id="foo"><p>foo</p></div><div id="bar"><p>bar</p></div><div id="baz"><p>baz</p></div>
31 is($actual, $expected, 'repeat with iterator works');
33 @list = qw(foo bar baz);
34 $actual = $z->select("#foo")->repeat([
38 $_->select("#foo")->set_attribute({name => 'id', value => $e})
39 ->select("p")->replace_content($e);
44 is($actual, $expected, 'repeat with array of transforms works');