Branch Coverage

blib/lib/HTML/Selector/Element.pm
Criterion Covered Total %
branch 129 220 58.6


line true false branch
12 7 0 if (@_)
50 35 0 if (@_)
56 0 35 if length $leftover
67 1 19 if ($op eq '!=') { }
13 6 elsif ($op eq '~=') { }
1 5 elsif ($op eq '*=') { }
1 4 elsif ($op eq '|=') { }
1 3 elsif ($op eq '^=') { }
1 2 elsif ($op eq '$=') { }
94 0 11 if ($n <= 0 and $cycle > 0)
100 45 21 if $of_type
101 0 66 $n > @sibling && $cycle < 0 ? :
108 32 110 $backward ? :
25 117 if $this == $sibling[$backward ? -$n : $n - 1]
137 70 86 if ($rule =~ s/$reg->{'element'}//) { }
7 79 elsif ($rule =~ s/$reg->{'attr2'}//) { }
1 78 elsif ($rule =~ s/$reg->{'attr1'}//) { }
0 78 elsif ($rule =~ /$reg->{'badattr'}/) { }
0 78 elsif ($rule =~ s/$reg->{'pseudoN'}//) { }
11 67 elsif ($rule =~ s/$reg->{'pseudo'}//) { }
139 1 69 if ($id_class eq '#') { }
12 57 elsif ($id_class eq '.') { }
57 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 89 if $any > 20000
246 0 67 if ($rule =~ s/$reg->{'comma'}//o) { }
32 35 elsif ($rule =~ s/$reg->{'combinator'}//) { }
249 0 0 if $sibling_root
257 4 28 unless ($any)
258 0 4 if ($set->{'chained'}) { }
270 16 16 unless $1
272 4 28 if ($chained->{'is_root'} or $chained->{'sibling_root'})
273 3 1 if ($combinator =~ /([+~])/)
285 0 35 if $hold
287 3 32 if $sibling_root
297 6 27 unless $refroot
302 0 57 unless $set->{'static'}
304 3 54 if ($set->{'is_root'})
306 3 0 if ($refroot) { }
316 27 30 if ($set->{'chained'}) { }
24 12 elsif ($banroot and not $set->{'is_root'}) { }
323 14 13 if ($combinator =~ /^\s+$/) { }
6 7 elsif ($combinator =~ />/) { }
7 0 elsif ($combinator =~ /\+/) { }
0 0 elsif ($combinator =~ /\~/) { }
327 57 50 if look_self($this, @params)
334 0 0 if look_self($this, @params)
339 14 0 $banroot ? :
343 3 0 if ($this = $this->{'_parent'} and $this != $rootparent)
344 3 0 if look_self($this, @params)
350 3 0 if ($this = $this->{'_parent'})
351 3 0 if look_self($this, @params)
355 3 3 $banroot ? :
362 0 7 unless ref $this and $this->{'_tag'} and not $this->{'_tag'} =~ /^~/
363 7 0 if look_self($this, @params)
375 0 0 unless ref $this and not $this->{'_tag'} =~ /^~/
376 0 0 if look_self($this, @params)
393 0 57 if $set->{'has'}
394 57 0 wantarray ? :
398 30 3 if (ref $set eq 'ARRAY')
399 0 30 if (@$set > 1)
403 0 0 unless $tags{'*'}
404 0 0 wantarray ? :
408 30 3 if (ref $set eq 'HASH') { }
3 0 elsif (ref $set) { }
423 0 26 if ref $sets ne 'ARRAY'
427 0 1 do { ref $set->{'sibling_root'} } ? :
1 25 $set->{'sibling_root'} ? :
441 27 51 if @$array
443 1 25 if (@via_right) { }
453 0 2 if (@down)
455 0 0 if (wantarray) { }
456 0 0 if $result = $root->look_down(@down)
462 2 0 if ref $_
2 0 if (my(@right) = grep({look_self($_, @right_filter) if ref $_;} $root->right))
463 2 0 unless ($right_down)
464 0 2 wantarray ? :
466 0 0 if (wantarray) { }
497 462 0 if ref $_ and $_->{'_tag'}
0 66 unless $this->{'_content'}
506 0 0 ref $matcher eq ref $value && $matcher eq $value ? :
30 37 ref $matcher eq 'Regexp' && $value =~ /$matcher/ ? :
45 0 $value eq $matcher ? :
67 45 ref $matcher ? :
0 112 ref $value ? :
13 112 2 != (defined($matcher = shift()) + defined($value = $this->{$attr}) || (next)) ? :
125 70 unless ref($attr = shift())
512 70 0 &$attr($this) ? :
70 0 if ref $attr eq 'CODE'
514 0 0 if (ref $attr eq 'ARRAY')
517 0 0 if ref $rule ne 'ARRAY'
518 0 0 if $success = look_self($this, @$rule)
520 0 0 if $success
539 0 1 unless @_