Branch Coverage

blib/lib/Mojo/DOM/CSS.pm
Criterion Covered Total %
branch 187 200 93.5


line true false branch
25 1 43 if $tree->[0] ne "tag"
32 48 3 _is_scoped($_) ? :
38 1215 1121 $tree->[0] eq 'root' ? :
40 97026 49827 unless $current->[0] eq "tag"
54 1094 833 if not $name =~ /$name_re/u or not defined $value and defined $value_re
55 489 344 if not defined $value && defined $value_re or $value =~ /$value_re/u
66 2114 2500 unless @$selectors and ref $selectors->[-1]
70 15 4599 if ($css =~ /\G\s*,\s*/cgu) { }
507 4092 elsif ($css =~ /\G\s*([>+~])\s*/cgu) { }
261 3831 elsif ($css =~ /\G\s+/cgu) { }
193 3638 elsif ($css =~ /\G([.#])((?:$ESCAPE_RE\s?|[^,.#:[\s>~+])+)/cgou) { }
285 3353 elsif ($css =~ /\G$ATTR_RE/cgou) { }
302 3051 elsif ($css =~ /\G:([\w\-]+)(?:\(((?:\([^)]+\)|[^)])+)\))?/cgsu) { }
1721 1330 elsif ($css =~ /\G((?:$ESCAPE_RE\s|\\[\s\S]|[^,.#:[\s>~+])+)/cgou) { }
74 11 496 unless @$last
80 0 261 unless @$last
86 76 117 $1 eq '.' ? :
98 6 15 $args =~ m[^/(.+)/$]u ? :
21 281 if $name eq "text"
101 49 247 if $name eq "has" or $name eq "is" or $name eq "not"
104 117 185 if $name =~ /^nth-/u
107 24 278 if $name =~ /^(?:first-(.+)|(last-.+))$/u
114 69 1652 (my $name = $1) =~ s/^([^|]*)\|//u && $1 ne '*' ? :
115 65 1656 length $alias ? :
116 45 1675 $name eq '*' ? :
119 2 1328 pos $css < length $css ? :
127 2 115 unless my $equation = shift()
130 9 106 if $equation =~ /^\s*even\s*$/iu
133 12 94 if $equation =~ /^\s*odd\s*$/iu
136 42 52 if $equation =~ /^\s*((?:\+|-)?\d+)\s*$/u
139 1 51 unless $equation =~ /^\s*((?:\+|-)?(?:\d+)?)?n\s*((?:\+|-)\s*\d+)?\s*$/iu
140 6 27 !length($1) ? :
18 33 $1 eq '-' ? :
158 1 1263 unless ref $compound
164 0 780 unless ref $next
169 37649 3387 if $seen{$cand}++
170 1847 1540 if _selector($next, $cand, $tree, $scope)
182 2212 833 ref $_ ? :
185 96 274 if $pc->[1] eq "scope"
188 10 264 if $pc->[1] eq 'has' || $pc->[1] eq 'is' || $pc->[1] eq 'not' and grep {_is_scoped($_);} @{$$pc[2];}
206 107 68 unless ref $compound and _selector($compound, $current, $tree, $scope)
212 0 8 unless ref $next
217 0 8 if $seen{$cand}++
218 4 4 if _selector($next, $cand, $tree, $scope)
221 4 4 unless @new
233 4 77 $current->[1] =~ /^([^:]+):/u ? :
235 4 123 if $current->[0] eq "root"
236 77 46 if exists $current->[2]{$attr}
249 554 1422 if $class eq "scope"
250 46 1376 if $current->[0] eq "root"
253 205 1171 if $class eq "checked"
256 102 1069 if $class eq "not"
259 20 1049 if $class eq "is"
262 22 1027 if $class eq "has"
265 40 987 if $class eq "empty"
268 54 933 if $class eq "root"
271 177 80 if $_->[0] eq "text" or $_->[0] eq "raw"
97 836 if $class eq "text"
275 26 797 if ($class eq "any-link" or $class eq "link" or $class eq "visited")
276 18 21 unless $current->[0] eq "tag" and exists $current->[2]{'href'}
281 26 771 if ($class eq "only-child" or $class eq "only-of-type")
282 6 20 $class eq 'only-of-type' ? :
288 763 8 if (ref $args)
289 68 695 $class eq 'nth-of-type' || $class eq 'nth-last-of-type' ? :
293 763 2441 if $siblings[$i] eq $current
295 233 530 if $class eq "nth-last-child" or $class eq "nth-last-of-type"
299 117 646 if $delta == 0
318 48 1205 if grep {_is_scoped($_);} @$group
326 5636 1773 unless $match{$node}
327 719 1054 if $one
331 86 448 $one ? :
343 10731 5456 if ($is_tag and $type eq 'tag') { }
2345 3111 elsif ($is_tag and $type eq 'attr') { }
1976 1135 elsif ($type eq 'pc') { }
344 6816 3915 if defined $s->[1] and not $current->[1] =~ /$s->[1]/u
345 20 3895 if defined $s->[2] and not _namespace($s->[2], $current)
349 1856 489 unless _attr(@$s[1, 2], $current)
352 1416 560 unless _pc(@$s[1, 2], $current, $tree, $scope)
364 95 798 $parent->[0] eq 'root' ? :
365 74 819 if defined $type
373 8 0 if ($combinator eq " " or $combinator eq ">")
377 8 0 if $combinator eq ">" or $node eq $scope
383 0 0 if $node->[0] eq "root"
386 0 0 if $sib eq $node
389 0 0 $combinator eq '+' ? :
396 1083 678 if $combinator eq " "
399 3 571 $node->[0] eq 'root' ? :
574 104 if $combinator eq ">"
402 0 104 if $node->[0] eq "root"
405 178 242 if $found
406 104 316 if $sib eq $node
408 50 54 $combinator eq '+' ? :
412 1652 2651 unless defined(my $value = shift())
428 48 430 unless defined $value
429 10 420 $insensitive ? :
432 99 331 if $op eq "~"
435 10 321 if $op eq "|"
438 12 309 if $op eq "*"
441 32 277 if $op eq "^"
444 31 246 if $op eq "\$"