#!/usr/bin/perl
# RT 21114 test case. Thanks Andrew Suhachov for finding it.
use warnings;
use strict;
use Test::More tests=>4;
BEGIN {
use_ok('HTML::TreeBuilder');
}
my $root = HTML::TreeBuilder->new();
my $escape = '
';
my $html = $root->parse($escape)->eof;
my $child = $root->look_down( _tag=>'tr', sub { my $tr = shift; $tr->look_down( _tag=>'td', _parent=>$tr) ? 1 : 0; } );
isa_ok( $child, 'HTML::Element', "Child found");
my @children = $root->look_down( _tag=>'tr', sub { my $tr = shift; $tr->look_down( _tag=>'td', _parent=>$tr) ? 1 : 0; } );
cmp_ok( scalar(@children), '==', '2', "2 total children found");
my $none = $root->look_down( _tag=>'tr', sub { 0 } );
ok(!defined($none),'No children found');