Branch Coverage

blib/lib/Mojo/DOM58/_CSS.pm
Criterion Covered Total %
branch 187 190 98.4


line true false branch
30 1083 0 @_ > 1 ? :
1083 0 @_ ? :
35 1083 0 unless @_
42 1 43 $tree->[0] ne 'tag' ? :
48 47 3 _is_scoped($_) ? :
54 1188 366 if _combinator($selectors, $current, $tree, $scope, $pos)
55 109 257 if $current eq $scope
56 157 100 if $one
68 345 664 if not $name =~ /$name_re/ or not defined $value and defined $value_re
69 409 255 if not defined $value && defined $value_re or $value =~ /$value_re/
79 5 8425 unless my $c = $selectors->[$pos]
80 8422 3 if (ref $c)
81 5156 3266 unless _selector($c, $current, $tree, $scope)
82 1668 1598 unless $c = $$selectors[++$pos]
86 986 615 if $c eq '>'
89 65 550 if $c eq '~'
92 66 484 if $c eq '+'
105 1854 2187 unless @$selectors and ref $selectors->[-1]
109 14 4027 if ($css =~ /\G\s*,\s*/cg) { }
703 3324 elsif ($css =~ /\G\s*([ >+~])\s*/cg) { }
148 3176 elsif ($css =~ /\G([.#])((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/cog) { }
254 2922 elsif ($css =~ /\G$ATTR_RE/cog) { }
276 2646 elsif ($css =~ /\G:([\w\-]+)(?:\(((?:\([^)]+\)|[^)])+)\))?/cgs) { }
1510 1136 elsif ($css =~ /\G((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/cog) { }
113 11 692 unless @$last
119 45 103 $1 eq '.' ? :
125 108 146 defined $2 ? :
2 141 defined $4 ? :
111 143 defined $3 ? :
140 49 221 if $name eq 'has' or $name eq 'is' or $name eq 'not'
143 116 160 if $name =~ /^nth-/
146 9 267 if $name =~ /^first-(.+)$/
149 15 261 if $name =~ /^last-/
156 69 1441 (my $name = $1) =~ s/^([^|]*)\|// && $1 ne '*' ? :
157 1 68 if defined $alias and length $alias and not defined $ns{$alias}
158 64 1445 defined $alias && length $alias ? :
159 23 1486 $name eq '*' ? :
162 2 1134 pos $css < length $css ? :
172 2 114 unless my $equation = shift()
175 9 105 if $equation =~ /^\s*even\s*$/i
178 12 93 if $equation =~ /^\s*odd\s*$/i
181 42 51 if $equation =~ /^\s*((?:\+|-)?\d+)\s*$/
184 1 50 unless $equation =~ /^\s*((?:\+|-)?(?:\d+)?)?n\s*((?:\+|-)\s*\d+)?\s*$/i
186 6 27 !length($1) ? :
17 33 $1 eq '-' ? :
192 1959 766 ref $_ ? :
195 94 251 if $pc->[1] eq 'scope'
198 10 241 if $pc->[1] eq 'has' || $pc->[1] eq 'is' || $pc->[1] eq 'not' and grep {_is_scoped($_);} @{$$pc[2];}
215 4 73 $current->[1] =~ /^([^:]+):/ ? :
217 4 117 if $current->[0] eq 'root'
218 73 44 if exists $current->[2]{$attr}
231 122 1556 if $class eq 'scope'
232 1 1555 if $current->[0] eq 'root'
236 204 1351 if $class eq 'checked'
239 169 1182 if $class eq 'not'
242 13 1169 if $class eq 'is'
245 29 1140 if $class eq 'has'
248 28 1112 if $class eq 'empty'
251 52 1060 if $class eq 'root'
254 26 1021 if ($class eq 'any-link' or $class eq 'link' or $class eq 'visited')
255 18 21 unless $current->[0] eq 'tag' and exists $current->[2]{'href'}
260 40 981 if ($class eq 'only-child' or $class eq 'only-of-type')
261 20 20 $class eq 'only-of-type' ? :
267 973 8 if (ref $args)
268 73 900 $class eq 'nth-of-type' || $class eq 'nth-last-of-type' ? :
271 343 630 if $class eq 'nth-last-child' or $class eq 'nth-last-of-type'
275 1178 3026 if (my $result = $args->[0] * $i + $args->[1]) < 1
276 178 2848 unless my $sibling = $siblings[$result - 1]
277 410 2438 if $sibling eq $current
296 47 1019 if grep {_is_scoped($_);} @$group
299 1017 49 $tree->[0] eq 'root' ? :
301 9626 6384 unless $current->[0] eq 'tag'
304 4797 1587 unless _match($group, $current, $tree, $scope)
305 575 1012 $one ? :
308 65 426 $one ? :
320 6575 3008 if ($is_tag and $type eq 'tag') { }
1226 1782 elsif ($is_tag and $type eq 'attr') { }
1678 104 elsif ($type eq 'pc') { }
321 3221 3354 if defined $s->[1] and not $current->[1] =~ /$s->[1]/
322 18 3336 if defined $s->[2] and not _namespace($s->[2], $current)
326 817 409 unless _attr(@$s[1, 2], $current)
329 996 682 unless _pc(@$s[1, 2], $current, $tree, $scope)
343 101 223 if $sibling eq $current
346 124 99 if ($immediate) { }
349 30 69 if _combinator($selectors, $sibling, $tree, $scope, $pos)
359 205 939 $parent->[0] eq 'root' ? :
361 93 1051 if defined $type
367 1441 2310 unless defined(my $value = shift())
383 48 354 unless defined $value
384 10 344 $insensitive ? :
387 68 286 if $op eq '~'
390 10 276 if $op eq '|'
393 12 264 if $op eq '*'
396 32 232 if $op eq '^'
399 31 201 if $op eq '$'