Branch Coverage

blib/lib/HTML/Selector/Element.pm
Criterion Covered Total %
branch 157 244 64.3


line true false branch
12 8 0 if (@_)
49 44 0 if (@_)
55 0 44 if length $leftover
66 1 20 if ($op eq '!=') { }
13 7 elsif ($op eq '~=') { }
1 6 elsif ($op eq '*=') { }
1 5 elsif ($op eq '|=') { }
1 4 elsif ($op eq '^=') { }
1 3 elsif ($op eq '$=') { }
93 0 11 if ($n <= 0 and $cycle > 0)
99 45 21 if $of_type
100 0 66 $n > @sibling && $cycle < 0 ? :
107 32 110 $backward ? :
25 117 if $this == $sibling[$backward ? -$n : $n - 1]
137 86 111 if ($rule =~ s/$reg->{'element'}//) { }
8 103 elsif ($rule =~ s/$reg->{'attr2'}//) { }
1 102 elsif ($rule =~ s/$reg->{'attr1'}//) { }
0 102 elsif ($rule =~ /$reg->{'badattr'}/) { }
0 102 elsif ($rule =~ s/$reg->{'pseudoN'}//) { }
11 91 elsif ($rule =~ s/$reg->{'pseudo'}//) { }
139 1 85 if ($id_class eq '#') { }
12 73 elsif ($id_class eq '.') { }
73 0 elsif (not $set->{'tag'} and $name ne '*') { }
167 0 0 unless $rule =~ s/^\s*\)//
169 0 0 if ($which eq 'not') { }
0 0 elsif ($which eq 'is') { }
0 0 elsif ($which eq 'has') { }
184 0 11 if (my(@expr) = $self->parse_pseudo($1, \$rule)) { }
0 11 elsif ($1 eq 'only-child') { }
11 0 elsif (my(@m) = $1 =~ /^((?:first|last)-(?:child|of-type)$) | ^(nth-(?:last-)?(?:child|of-type)) \((odd|even|(\d+)|(-?\d*)n([\+\-]\d+)?)\)$/x) { }
0 0 elsif ($1 =~ /^contains\($/) { }
0 0 elsif ($1 eq 'root') { }
0 0 elsif ($1 eq 'empty') { }
196 9 2 if ($nth) { }
197 4 5 if (defined $cycle) { }
3 2 elsif (not defined $n) { }
198 1 3 if $cycle =~ /^(-?)$/
204 1 2 $expr eq 'odd' ? :
217 0 0 if ($rule =~ s/^\s*"([^"]*)"\s*\)//) { }
0 0 elsif ($rule =~ s/^\s*'([^']*)'\s*\)//) { }
241 0 106 if $any > 20000
246 0 91 if ($rule =~ s/$reg->{'comma'}//o) { }
47 44 elsif ($rule =~ s/$reg->{'combinator'}//) { }
249 0 0 if $sibling_root
250 0 0 if $root_child
251 0 0 length $rule ? :
260 12 35 unless ($any)
261 0 12 if ($set->{'chained'}) { }
273 18 29 unless $1
274 47 0 length $rule ? :
276 7 40 if ($chained->{'is_root'} || $chained->{'sibling_root'} and $combinator =~ /([+~])/)
280 6 41 if ($chained->{'is_root'} and $combinator =~ />/) { }
3 74 elsif ($chained->{'root_child'} and $combinator =~ /([+~])/) { }
290 0 44 length $rule ? :
296 0 44 if $hold
298 6 38 if $sibling_root
299 6 38 if $root_child
311 35 6 $refroot ? :
315 0 75 unless $set->{'static'}
317 10 65 if ($set->{'is_root'})
319 10 0 if ($refroot) { }
329 37 38 if ($set->{'chained'}) { }
25 26 elsif ($banroot and not $set->{'is_root'}) { }
330 10 27 if $set->{'chained'}{'is_root'}
337 15 22 if ($combinator =~ /^\s+$/) { }
10 12 elsif ($combinator =~ />/) { }
8 4 elsif ($combinator =~ /\+/) { }
4 0 elsif ($combinator =~ /\~/) { }
341 62 50 if look_self($this, @params)
348 0 0 if look_self($this, @params)
353 15 0 $banroot ? :
357 11 0 if ($this = $this->{'_parent'} and $this != $rootparent)
358 11 0 if look_self($this, @params)
364 43 0 if ($this = $this->{'_parent'})
365 43 0 if look_self($this, @params)
369 3 7 $banroot ? :
376 0 21 unless ref $this and $this->{'_tag'} and not $this->{'_tag'} =~ /^~/
377 21 0 if look_self($this, @params)
389 0 51 unless ref $this and not $this->{'_tag'} =~ /^~/
390 21 30 if look_self($this, @params)
407 0 75 if $set->{'has'}
408 75 0 wantarray ? :
412 38 3 if (ref $set eq "ARRAY")
413 0 38 if (@$set > 1)
417 0 0 unless $tags{'*'}
418 0 0 wantarray ? :
422 38 3 if (ref $set eq 'HASH') { }
3 0 elsif (ref $set) { }
437 0 32 if ref $sets ne "ARRAY"
441 1 2 do { ref $set->{'sibling_root'} } ? :
3 29 $set->{'sibling_root'} ? :
455 35 61 if @$array
458 3 29 if (@via_right) { }
460 4 25 unless not $_->{'root_child'}
26 3 if (grep {ref $_->{'root_child'} unless not $_->{'root_child'};} @$sets) { }
470 34 0 if ref $_
471 2 3 wantarray ? :
479 0 6 if (@down)
481 0 0 if (wantarray) { }
482 0 0 if $result = $root->look_down(@down)
488 18 0 if ref $_
6 0 if (my(@right) = grep({look_self($_, @right_filter) if ref $_;} $root->right))
489 4 2 unless ($right_down)
490 1 3 wantarray ? :
492 1 1 if (wantarray) { }
499 1 0 if wantarray
525 462 0 if ref $_ and $_->{'_tag'}
0 66 unless $this->{'_content'}
534 0 0 ref $matcher eq ref $value && $matcher eq $value ? :
30 37 ref $matcher eq 'Regexp' && $value =~ /$matcher/ ? :
122 1 $value eq $matcher ? :
67 123 ref $matcher ? :
0 190 ref $value ? :
13 190 2 != (defined($matcher = shift()) + defined($value = $this->{$attr}) || (next)) ? :
203 237 unless ref($attr = shift())
540 205 32 &$attr($this) ? :
237 0 if ref $attr eq "CODE"
542 0 0 if (ref $attr eq "ARRAY")
545 0 0 if ref $rule ne "ARRAY"
546 0 0 if $success = look_self($this, @$rule)
548 0 0 if $success
567 0 1 unless @_