Branch Coverage

blib/lib/HTML/DOM/Element/Form.pm
Criterion Covered Total %
branch 237 294 80.6


line true false branch
20 4985 23 if $self->isa(scalar caller) or (caller)->isa('HTML::DOM::_TreeBuilder')
42 17 8 unless $self->{'_HTML_DOM_mg_elems'}
49 13 43 if (wantarray) { }
59 6 3 if $elem_elems{$_[0]->tag}
74 22 17 unless my $base = $self->ownerDocument->base
83 34 0 defined $ret ? :
88 48 0 defined $ret ? :
122 106 0 unless $self->{'_HTML_DOM_mg_elems'}
130 104 397 if (lc $_->attr('type') eq 'radio')
134 59 45 exists $pos{$name} ? :
137 75 79 $_->attr('multiple') ? :
154 243 $tag eq 'select' ? :
143 45 509 ref $_ eq 'ARRAY' ? :
151 0 12 if @_ % 2 == 1
156 18 1 unless $tag eq 'input' and $type =~ /^(?:submit|image)\z/ or $tag eq 'button' and ($type || 'submit') eq 'submit'
158 0 6 if $name and $_->name ne $name
159 1 5 if $_->disabled
162 0 7 if $name
174 0 15 unless $input
185 1 30 if (wantarray) { }
189 0 2 if (defined $name)
190 0 0 unless defined(my $n = $_->name)
191 0 0 if $name ne $n
193 0 2 if $type and $type ne $_->type
195 0 2 if $no and $no != $c
204 72 0 if (defined $name)
205 0 72 unless defined(my $n = $_->name)
206 42 30 if $name ne $n
208 0 30 if $type and $type ne $_->type
209 0 30 if --$no
220 25 2 if (@_) { }
225 132 43 if not defined $n or $n ne $name
229 8 17 if (@_) { }
231 0 8 unless @inputs
233 3 5 if @v == 1 and ref $v[0]
241 7 6 unless ($@)
248 1 7 if $err
260 16 12 if (defined(my $v = $_->value))
264 12 5 wantarray ? :
273 6 8 if not defined $n or $seen{$n}++
287 14 6 $xwfu ? :
299 10 13 if eval { do { @ret = (); foreach my $applyee (@$apply_to) { push @ret, ref $applyee ? $applyee : Encode::encode($_, $applyee, 9); } ; $charset = $_ } }
305 2 39 ref $applyee ? :
315 26 10 unless ($charset)
322 1 96 ref $_ ? :
324 22 4 if $fallback
353 25 8 unless (@charsets)
363 18 15 if ($method ne 'post') { }
367 17 1 if $uri->can('query_form')
372 9 6 if ($xwfu) { }
386 1 9 if $enc =~ /[^ -~]/
387 3 7 ref $val->[0] ? :
424 0 39 if (@_)
436 5 12 if $btn->checked
440 7 2 if (@_)
442 7 3 if $_[0] eq $btn->attr('value')
451 3 3 if $checked_elem
462 3 2 unless $_->disabled
474 0 7 unless defined $name and length $name
475 0 7 if $self->disabled
477 1 6 unless defined $value
513 43 123 if ($elem = $list->item($_))->id eq $name or $elem->attr('name') eq $name
518 13 17 if (@list > 1)
530 17 0 @list ? :
684 8 2 if (defined wantarray)
690 7 6 if $_->selected
695 1 7 unless defined $ret
698 2 8 if @_
706 60 18 if defined wantarray
709 9 9 defined $_[0] ? :
18 60 if @_
711 39 37 unless $ret
717 17 97 if (wantarray) { }
730 12 7 $_[0] ? :
19 107 @_ ? :
733 5 12 @_ ? :
790 3 8 if $opt->selected
794 1 4 if (@_)
797 0 3 if $_[0] eq $v
806 2 3 unless defined $sel_elem
818 1 5 if (my $self = shift())->item(0)->look_up('_tag', 'select')->disabled
821 4 2 unless $_->disabled
828 1 7 if @_
859 3 2 $_[0] ? :
5 3 @_ ? :
872 2 1 if $self == $_
876 0 2 unless defined $indx
880 0 2 if (@_)
882 0 0 if $new_indx == $indx
883 0 0 if ($new_indx == 0)
901 37 14 if (not defined $self->{'_HTML_DOM_sel'}) { }
907 11 40 if (@_ and !$ret != !$_[0])
909 8 3 if (not $sel or $sel->multiple) { }
2 1 elsif ($_[0]) { }
928 9 13 if ((caller) =~ /^(?:HTML::Form(?:::Input)?|WWW::Mechanize)\z/)
930 2 7 $self->selected ? :
931 0 0 $_[0] eq $self->value ? :
0 0 defined $_[0] ? :
0 9 if @_
940 3 10 unless defined($ret = $self->attr('value', @_))
971 3 1 $_[0] ? :
4 63 @_ ? :
981 43 66 if (not defined $self->{'_HTML_DOM_checked'}) { }
987 8 15 if (@_ and !$ret != !($self->{'_HTML_DOM_checked'} = shift()) and not $ret and $self->type eq 'radio')
989 8 0 if (my $form = $self->form and defined(my $name = $self->name))
1004 4 4 $_[0] ? :
8 4 @_ ? :
1010 351 0 defined $ret ? :
1017 40 59 if ((caller) =~ /^(?:HTML::Form(?:::Input)?|WWW::Mechanize)\z/ and ($type = $self->type) =~ /^(?:button|reset)\z/ && (return) || $type eq 'checkbox')
1022 1 39 unless length $value
1023 25 15 $self->checked ? :
1026 6 6 $_[0] eq $value ? :
12 7 defined $_[0] ? :
19 21 if @_
1039 100 45 if (not defined $self->{'_HTML_DOM_value'}) { }
1045 37 108 if @_
1062 0 7 if $_->type eq 'checkbox'
1081 9 91 $input_type =~ /^(?:(submi)|rese)t\z/ ? :
1088 0 0 wantarray ? :
0 0 $_[0]->type eq 'checkbox' ? :
1095 6 58 if ($type =~ /^(image|submit)\z/)
1096 2 4 unless $self->{'_HTML_DOM_clicked'}
1097 2 2 if ($1 eq 'image')
1099 1 1 length $name ? :
1104 5 55 $type eq 'file' ? :
1116 2 54 unless defined $name and length $name
1117 1 53 if $self->disabled
1119 2 51 unless defined $value
1127 1 4 if uc $form->method ne 'POST' or lc $form->enctype ne 'multipart/form-data'
1132 0 4 unless defined $name
1133 0 4 if $self->{'disabled'}
1139 0 4 if (defined $content) { }
1 3 elsif (not defined $file or length $file == 0) { }
1140 0 0 unless defined $filename
1149 0 3 if (ref $file eq 'ARRAY')
1154 0 0 unless defined $filename
1167 0 4 if @_
1168 4 0 unless defined $old
1177 0 4 if @_
1210 4 1 if (not defined $self->{'_HTML_DOM_value'}) { }
1216 1 4 if @_
1249 4 4 unless not $type or $type eq 'submit'
1250 2 2 unless $self->{'_HTML_DOM_clicked'}
1252 0 2 unless defined $name and length $name
1253 0 2 if $self->disabled
1255 0 2 unless defined $value
1280 27 0 $input_type =~ /^(?:(submi)|rese)t\z/ ? :