Branch Coverage

blib/lib/Mojo/DOM/CSS.pm
Criterion Covered Total %
branch 195 202 96.5


line true false branch
25 2 49 if $tree->[0] ne "tag"
32 48 3 _is_scoped($_) ? :
38 1218 1121 $tree->[0] eq 'root' ? :
40 97050 49848 unless $current->[0] eq "tag"
52 1509 837 unless exists $attrs->{$name}
55 1 836 if not defined $value and defined $value_re
56 488 348 if not defined $value_re or $value =~ /$value_re/u
66 2129 2515 unless @$selectors and ref $selectors->[-1]
70 15 4629 if ($css =~ /\G\s*,\s*/cgu) { }
513 4116 elsif ($css =~ /\G\s*([>+~])\s*/cgu) { }
261 3855 elsif ($css =~ /\G\s+/cgu) { }
196 3659 elsif ($css =~ /\G([.#])((?:$ESCAPE_RE\s?|[^,.#:[\s>~+])+)/cgou) { }
281 3378 elsif ($css =~ /\G$ATTR_RE/cgou) { }
302 3076 elsif ($css =~ /\G:([\w\-]+)(?:\(((?:\([^)]+\)|[^)])+)\))?/cgsu) { }
1737 1339 elsif ($css =~ /\G((?:$ESCAPE_RE\s|\\[\s\S]|[^,.#:[\s>~+])+)/cgou) { }
74 11 502 unless @$last
80 0 261 unless @$last
86 76 120 $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 1668 (my $name = $1) =~ s/^([^|]*)\|//u && $1 ne '*' ? :
115 65 1672 length $alias ? :
116 45 1691 $name eq '*' ? :
119 2 1337 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 1266 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 2215 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 109 72 unless ref $compound and _selector($compound, $current, $tree, $scope)
212 0 12 unless ref $next
217 0 15 if $seen{$cand}++
218 7 8 if _selector($next, $cand, $tree, $scope)
221 5 7 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 1208 if grep {_is_scoped($_);} @$group
326 5670 1776 unless $match{$node}
327 722 1054 if $one
331 86 448 $one ? :
343 10764 5460 if ($is_tag and $type eq 'tag') { }
2346 3114 elsif ($is_tag and $type eq 'attr') { }
1976 1138 elsif ($type eq 'pc') { }
344 6838 3926 if defined $s->[1] and not $current->[1] =~ /$s->[1]/u
345 20 3906 if defined $s->[2] and not _namespace($s->[2], $current)
349 1858 488 unless _attr(@$s[1, 2], $current)
352 1416 560 unless _pc(@$s[1, 2], $current, $tree, $scope)
364 99 798 $parent->[0] eq 'root' ? :
365 74 823 if defined $type
373 8 4 if ($combinator eq " " or $combinator eq ">")
377 8 0 if $combinator eq ">" or $node eq $scope
383 0 4 if $node->[0] eq "root"
386 4 10 if $sib eq $node
389 2 2 $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 1668 2473 unless defined(my $value = shift())
428 44 433 unless defined $value
429 10 423 $insensitive ? :
432 99 334 if $op eq "~"
435 10 324 if $op eq "|"
438 12 312 if $op eq "*"
441 32 280 if $op eq "^"
444 31 249 if $op eq "\$"