Branch Coverage

blib/lib/HTML/DOM/_TreeBuilder.pm
Criterion Covered Total %
branch 163 298 54.7


line true false branch
33 0 24 if (defined &HTML::DOM::_TreeBuilder::DEBUG) { }
0 24 elsif ($] < 5.00404) { }
24 0 elsif (not $HTML::DOM::_TreeBuilder::DEBUG) { }
0 0 elsif ($HTML::DOM::_TreeBuilder::DEBUG =~ /^\d+$/s) { }
87 0 0 unless @_ == 1
89 0 0 if ref $class
98 0 0 if ref $class
102 0 0 if (ref $whunk eq 'SCALAR') { }
108 0 0 if $new->{'_stunted'}
119 0 0 if (ref $whunk eq 'SCALAR') { }
125 0 0 if $tree->{'_stunted'}
178 147 0 if (@_)
208 441 0 if defined $val
234 0 2 if $self->{'_warn'}
248 0 595 if $_[0]{'_stunted'}
257 0 595 if ($tag eq 'x-html')
266 0 595 unless ($tag =~ /^[-_a-zA-Z0-9:%]+$/s)
298 0 539 if length $k and substr($k, 0, 1) eq '_'
310 595 0 if ($self->{'_implicit_tags'})
312 550 45 unless ($HTML::DOM::_TreeBuilder::isTableElement{$tag})
313 0 550 if ($ptag eq 'table') { }
0 550 elsif ($ptag eq 'tr') { }
337 0 0 if ($self->{'_p_strict'} and $HTML::DOM::_TreeBuilder::isKnown{$tag} and not $HTML::Tagset::is_Possible_Strict_P_Content{$tag})
344 0 0 if ($here_tag eq 'p')
358 0 0 if $HTML::DOM::_TreeBuilder::isKnown{$here_tag} and not $HTML::Tagset::is_Possible_Strict_P_Content{$here_tag}
375 0 595 if (not $self->{'_implicit_tags'}) { }
19 576 elsif ($HTML::DOM::_TreeBuilder::isHeadOrBodyElement{$tag}) { }
494 82 elsif ($HTML::DOM::_TreeBuilder::isBodyElement{$tag}) { }
42 40 elsif ($HTML::DOM::_TreeBuilder::isHeadElement{$tag}) { }
11 29 elsif ($tag eq 'html') { }
5 24 elsif ($tag eq 'head') { }
22 2 elsif ($tag eq 'body') { }
0 2 elsif ($tag eq 'frameset') { }
0 2 elsif ($tag eq 'frame') { }
0 2 elsif ($tag eq 'noframes') { }
383 9 10 if ($pos->is_inside('body')) { }
4 6 elsif ($pos->is_inside('head')) { }
397 6 0 if ($ptag eq 'html') { }
401 0 6 unless ref $self->{'_head'}
402 6 0 if ($self->{'_head'}{'_implicit'}) { }
436 63 431 if ($ptag eq 'body') { }
346 85 elsif ($HTML::DOM::_TreeBuilder::isBodyElement{$ptag} and not $HTML::DOM::_TreeBuilder::isHeadOrBodyElement{$ptag}) { }
12 73 elsif ($pos->is_inside('head')) { }
73 0 elsif (not $pos->is_inside('body')) { }
481 162 332 if ($tag eq 'p' or $tag eq 'h1' or $tag eq 'h2' or $tag eq 'h3' or $tag eq 'h4' or $tag eq 'h5' or $tag eq 'h6' or $tag eq 'form') { }
2 330 elsif ($tag eq 'ol' or $tag eq 'ul' or $tag eq 'dl') { }
8 322 elsif ($tag eq 'li') { }
0 322 elsif ($tag eq 'dt' or $tag eq 'dd') { }
142 180 elsif ($HTML::DOM::_TreeBuilder::isFormElement{$tag}) { }
45 135 elsif ($HTML::DOM::_TreeBuilder::isTableElement{$tag}) { }
61 74 elsif ($HTML::DOM::_TreeBuilder::isPhraseMarkup{$tag}) { }
507 0 2 if ($ptag eq 'h1' or $ptag eq 'h2' or $ptag eq 'h3' or $ptag eq 'h4' or $ptag eq 'h5' or $ptag eq 'h6')
525 0 8 unless (exists $HTML::DOM::_TreeBuilder::isList{$ptag} or $self->end(\'*', keys %HTML::DOM::_TreeBuilder::isList))
541 0 0 unless ($ptag eq 'dl' or $self->end(\'*', 'dl'))
550 0 142 if ($self->{'_ignore_formies_outside_form'} and not $pos->is_inside('form'))
560 45 97 if ($tag eq 'option')
565 0 45 unless ($ptag eq 'select' or $ptag eq 'optgroup')
577 0 45 unless ($pos->is_inside('table'))
583 22 23 if ($tag eq 'td' or $tag eq 'th') { }
586 0 22 unless ($ptag eq 'tr' or $self->end(\'*', 'tr', 'table'))
619 0 22 if ($ptag eq 'body' and $self->{'_implicit_body_p_tag'})
636 0 42 if ($pos->is_inside('body')) { }
21 21 elsif (not $pos->is_inside('head')) { }
656 11 0 if (delete $self->{'_implicit'}) { }
677 5 0 if (delete $head->{'_implicit'}) { }
697 22 0 if (delete $body->{'_implicit'}) { }
711 20 2 unless $pos->is_inside('body')
717 0 0 unless ($self->{'_frameset_seen'}++ or $self->{'_noframes_seen'} or $self->is_inside('body'))
734 0 0 if ($c->[$i] eq $body)
744 0 0 unless $already_inserted
763 0 0 if ($self->{'_noframes_seen'}++) { }
767 0 0 if ($pos->is_inside('body')) { }
787 2 0 if ($self->{'_ignore_unknown'}) { }
814 0 555 if ($self->{'_tighten'} and not $self->{'_ignore_text'})
817 0 0 if ($sibs = +($par = $self->{'_pos'} || $self)->{'_content'} and @$sibs and not ref $sibs->[-1] and not $sibs->[-1] =~ /[^\n\r\f\t ]/s and $HTML::DOM::_TreeBuilder::canTighten{$tag} || (@$sibs == 1 ? $HTML::DOM::_TreeBuilder::canTighten{$par->{'_tag'}} : ref $sibs->[-2] && $HTML::DOM::_TreeBuilder::canTighten{$sibs->[-2]{'_tag'}}) and not $par->is_inside('pre', 'xmp', 'textarea', 'plaintext'))
847 555 0 unless $already_inserted
867 107 448 unless (($self->{'_pos'} || '') eq $e)
871 0 107 unless $$self{"_tweak_$tag"} or $self->{'_tweak_*'}
886 0 602 if $_[0]{'_stunted'}
892 0 602 if ($tag eq 'x-html')
899 0 602 unless (ref $tag or $tag =~ /^[-_a-zA-Z0-9:%]+$/s)
920 244 358 if (ref $tag) { }
924 82 162 if ref $tag eq 'SCALAR'
932 2 356 $tag =~ /^t[hdr]\z/ ? :
972 8 594 if ($tag eq '*') { }
162 432 elsif (ref $tag) { }
981 8 26 if ($ptag eq $_)
994 0 8 unless (defined $p)
1016 65 1980 if ($ptag eq $_)
1022 33 3237 if ($ptag eq $_)
1032 64 65 unless defined $p
1044 389 357 if ($ptag eq $tag)
1049 23 12 if ($ptag eq $_)
1059 20 389 unless defined $p
1065 12 450 if $self eq ($self->{'_pos'} || '')
1119 0 681 unless $$self{"_tweak_$ptag"} or $self->{'_tweak_*'}
1123 0 693 if $self->{'_stunted'}
1135 0 548 if $_[0]{'_stunted'}
1143 0 548 unless length $text
1153 535 1 unless $ignore_text or $is_cdata or $HTML::Tagset::isCDATA_Parent{$pos->{'_tag'}} or $no_expand_entities
1178 15 533 if ($HTML::Tagset::isCDATA_Parent{$ptag = $pos->{'_tag'}} or $pos->is_inside('pre', 'textarea')) { }
1184 0 15 if $ignore_text
1191 315 218 if (not $self->{'_implicit_tags'} && $text =~ /[^\n\r\f\t ]/) { }
2 216 elsif ($ptag eq 'head' or $ptag eq 'noframes') { }
4 212 elsif ($ptag eq 'html') { }
4 208 elsif ($ptag eq 'body') { }
0 208 elsif ($ptag eq 'table') { }
0 208 elsif ($ptag eq 'tr') { }
1196 0 2 if ($self->{'_implicit_body_p_tag'}) { }
1203 0 0 $self->{'_body'} ? :
1214 2 0 $self->{'_body'} ? :
1219 0 4 if ($self->{'_implicit_body_p_tag'}) { }
1225 0 0 $self->{'_body'} ? :
1235 4 0 $self->{'_body'} ? :
1242 0 4 if ($self->{'_implicit_body_p_tag'})
1275 0 533 if $ignore_text
1276 0 533 unless $no_space_compacting
1288 0 548 unless $self->{'_tweak_~text'}
1307 0 7 if $_[0]{'_stunted'}
1315 0 7 unless $self->{'_store_comments'} or $HTML::Tagset::isCDATA_Parent{$pos->{'_tag'}}
1336 0 7 unless $self->{'_tweak_~comment'} or $self->{'_tweak_*'}
1343 0 0 if $_[0]{'_stunted'}
1372 0 0 if $_[0]{'_stunted'}
1376 0 0 unless $_[0]{'_store_pis'}
1397 0 0 unless $self->{'_tweak_~pi'} or $self->{'_tweak_*'}
1426 3 125 if $_[0]{'_done'}
1428 0 125 if $_[0]{'_stunted'}
1433 0 125 if (wantarray) { }
1443 103 22 unless $x eq ($x->{'_pos'} || $x)
1449 0 124 unless ($x->{'_implicit_tags'})
1458 0 0 if defined $node and ref $node and $node->{'_implicit'} and $node->{'_parent'}
1472 0 124 if $x->{'_tighten'} and not $x->{'_ignore_text'}
1475 0 124 if wantarray
1488 0 0 if ($HTML::Parser::VERSION < 3) { }
1495 0 0 if (defined $fh)
1535 0 0 unless delete $_[0]{'_content'}
1554 0 0 if defined $_ and ref $_ and $_ ne $_[0]
1559 0 0 if $_[0]{'_parent'} and $_[0]{'_parent'}{'_content'}
1578 2218 175 if length $_ and substr($_, 0, 1) eq '_' and $_ ne '_tag' and $_ ne '_parent' and $_ ne '_content' and $_ ne '_implicit' and $_ ne '_pos'
1593 0 0 unless ref $_[0]
1606 0 135 if (not ref $this) { }
38 97 elsif (not $this->{'_implicit'}) { }
1611 0 38 if $destructive
1616 0 97 if $destructive
1621 0 97 $destructive ? :
40 57 unless $destructive ? delete $this->{'_content'} : $this->{'_content'}
1631 31 0 if wantarray
1632 0 0 unless @out
1633 0 0 if @out == 1 and ref $out[0]