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 594 if $_[0]{'_stunted'}
257 0 594 if ($tag eq 'x-html')
266 0 594 unless ($tag =~ /^[-_a-zA-Z0-9:%]+$/s)
298 0 538 if length $k and substr($k, 0, 1) eq '_'
310 594 0 if ($self->{'_implicit_tags'})
312 549 45 unless ($HTML::DOM::_TreeBuilder::isTableElement{$tag})
313 0 549 if ($ptag eq 'table') { }
0 549 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 594 if (not $self->{'_implicit_tags'}) { }
19 575 elsif ($HTML::DOM::_TreeBuilder::isHeadOrBodyElement{$tag}) { }
493 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 430 if ($ptag eq 'body') { }
345 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 331 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 329 elsif ($tag eq 'ol' or $tag eq 'ul' or $tag eq 'dl') { }
8 321 elsif ($tag eq 'li') { }
0 321 elsif ($tag eq 'dt' or $tag eq 'dd') { }
141 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 141 if ($self->{'_ignore_formies_outside_form'} and not $pos->is_inside('form'))
560 45 96 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 554 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 554 0 unless $already_inserted
867 107 447 unless (($self->{'_pos'} || '') eq $e)
871 0 107 unless $$self{"_tweak_$tag"} or $self->{'_tweak_*'}
886 0 601 if $_[0]{'_stunted'}
892 0 601 if ($tag eq 'x-html')
899 0 601 unless (ref $tag or $tag =~ /^[-_a-zA-Z0-9:%]+$/s)
920 244 357 if (ref $tag) { }
924 82 162 if ref $tag eq 'SCALAR'
932 2 355 $tag =~ /^t[hdr]\z/ ? :
972 8 593 if ($tag eq '*') { }
162 431 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 388 357 if ($ptag eq $tag)
1049 23 12 if ($ptag eq $_)
1059 20 388 unless defined $p
1065 12 449 if $self eq ($self->{'_pos'} || '')
1119 0 680 unless $$self{"_tweak_$ptag"} or $self->{'_tweak_*'}
1123 0 692 if $self->{'_stunted'}
1135 0 547 if $_[0]{'_stunted'}
1143 0 547 unless length $text
1153 534 1 unless $ignore_text or $is_cdata or $HTML::Tagset::isCDATA_Parent{$pos->{'_tag'}} or $no_expand_entities
1179 15 532 if ($HTML::Tagset::isCDATA_Parent{$ptag = $pos->{'_tag'}} or $pos->is_inside('pre', 'textarea')) { }
1185 0 15 if $ignore_text
1192 315 217 if (not $self->{'_implicit_tags'} && $text =~ /[^\n\r\f\t ]/) { }
2 215 elsif ($ptag eq 'head' or $ptag eq 'noframes') { }
4 211 elsif ($ptag eq 'html') { }
4 207 elsif ($ptag eq 'body') { }
0 207 elsif ($ptag eq 'table') { }
0 207 elsif ($ptag eq 'tr') { }
1197 0 2 if ($self->{'_implicit_body_p_tag'}) { }
1204 0 0 $self->{'_body'} ? :
1215 2 0 $self->{'_body'} ? :
1220 0 4 if ($self->{'_implicit_body_p_tag'}) { }
1226 0 0 $self->{'_body'} ? :
1236 4 0 $self->{'_body'} ? :
1243 0 4 if ($self->{'_implicit_body_p_tag'})
1276 0 532 if $ignore_text
1277 0 532 unless $no_space_compacting
1289 0 547 unless $self->{'_tweak_~text'}
1308 0 7 if $_[0]{'_stunted'}
1316 0 7 unless $self->{'_store_comments'} or $HTML::Tagset::isCDATA_Parent{$pos->{'_tag'}}
1338 0 7 unless $self->{'_tweak_~comment'} or $self->{'_tweak_*'}
1345 0 0 if $_[0]{'_stunted'}
1375 0 0 if $_[0]{'_stunted'}
1379 0 0 unless $_[0]{'_store_pis'}
1401 0 0 unless $self->{'_tweak_~pi'} or $self->{'_tweak_*'}
1430 3 125 if $_[0]{'_done'}
1432 0 125 if $_[0]{'_stunted'}
1437 0 125 if (wantarray) { }
1447 103 22 unless $x eq ($x->{'_pos'} || $x)
1453 0 124 unless ($x->{'_implicit_tags'})
1462 0 0 if defined $node and ref $node and $node->{'_implicit'} and $node->{'_parent'}
1476 0 124 if $x->{'_tighten'} and not $x->{'_ignore_text'}
1479 0 124 if wantarray
1492 0 0 if ($HTML::Parser::VERSION < 3) { }
1499 0 0 if (defined $fh)
1539 0 0 unless delete $_[0]{'_content'}
1558 0 0 if defined $_ and ref $_ and $_ ne $_[0]
1563 0 0 if $_[0]{'_parent'} and $_[0]{'_parent'}{'_content'}
1582 2218 175 if length $_ and substr($_, 0, 1) eq '_' and $_ ne '_tag' and $_ ne '_parent' and $_ ne '_content' and $_ ne '_implicit' and $_ ne '_pos'
1597 0 0 unless ref $_[0]
1610 0 135 if (not ref $this) { }
38 97 elsif (not $this->{'_implicit'}) { }
1615 0 38 if $destructive
1620 0 97 if $destructive
1625 0 97 $destructive ? :
40 57 unless $destructive ? delete $this->{'_content'} : $this->{'_content'}
1635 31 0 if wantarray
1636 0 0 unless @out
1637 0 0 if @out == 1 and ref $out[0]