Branch Coverage

blib/lib/Mojo/DOM58/_CSS.pm
Criterion Covered Total %
branch 168 172 97.6


line true false branch
26 982 0 @_ > 1 ? :
982 0 @_ ? :
31 982 0 unless @_
38 1 43 $tree->[0] ne 'tag' ? :
48 85 1300 if $current->[0] eq 'root' or $current eq $tree
49 1093 207 if _combinator($selectors, $current, $tree, $pos)
50 137 70 if $one
62 365 607 if not $name =~ /$name_re/ or not defined $value and defined $value_re
63 386 221 if not defined $value && defined $value_re or $value =~ /$value_re/
73 2 7367 unless my $c = $selectors->[$pos]
74 7364 3 if (ref $c)
75 4430 2934 unless _selector($c, $current)
76 1521 1413 unless $c = $$selectors[++$pos]
80 888 528 if $c eq '>'
83 47 481 if $c eq '~'
86 54 427 if $c eq '+'
99 1656 1984 unless @$selectors and ref $selectors->[-1]
103 11 3629 if ($css =~ /\G\s*,\s*/cg) { }
619 3010 elsif ($css =~ /\G\s*([ >+~])\s*/cg) { }
140 2870 elsif ($css =~ /\G([.#])((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/cog) { }
245 2625 elsif ($css =~ /\G$ATTR_RE/cog) { }
234 2391 elsif ($css =~ /\G:([\w\-]+)(?:\(((?:\([^)]+\)|[^)])+)\))?/cgs) { }
1366 1025 elsif ($css =~ /\G((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/cog) { }
110 41 99 $1 eq '.' ? :
116 104 141 defined $2 ? :
2 135 defined $4 ? :
108 137 defined $3 ? :
131 45 189 if $name eq 'matches' or $name eq 'not'
134 113 121 if $name =~ /^nth-/
137 6 228 if $name =~ /^first-(.+)$/
140 14 220 if $name =~ /^last-/
147 69 1297 (my $name = $1) =~ s/^([^|]*)\|// && $1 ne '*' ? :
148 1 68 if defined $alias and length $alias and not defined $ns{$alias}
149 64 1301 defined $alias && length $alias ? :
150 21 1344 $name eq '*' ? :
159 56 2 unless $_[0][0] eq 'comment'
162 2 111 unless my $equation = shift()
165 9 102 if $equation =~ /^\s*even\s*$/i
168 12 90 if $equation =~ /^\s*odd\s*$/i
171 39 51 if $equation =~ /^\s*((?:\+|-)?\d+)\s*$/
174 1 50 unless $equation =~ /^\s*((?:\+|-)?(?:\d+)?)?n\s*((?:\+|-)\s*\d+)?\s*$/i
176 6 27 !length($1) ? :
17 33 $1 eq '-' ? :
190 4 73 $current->[1] =~ /^([^:]+):/ ? :
192 4 117 if $current->[0] eq 'root'
193 73 44 if exists $current->[2]{$attr}
207 204 1259 if $class eq 'checked'
210 145 1114 if $class eq 'not'
213 9 1105 if $class eq 'matches'
216 28 1077 if $class eq 'empty'
219 52 1025 if $class eq 'root'
222 26 999 if ($class eq 'link' or $class eq 'visited')
223 12 14 unless $current->[0] eq 'tag' and exists $current->[2]{'href'}
228 40 959 if ($class eq 'only-child' or $class eq 'only-of-type')
229 20 20 $class eq 'only-of-type' ? :
235 951 8 if (ref $args)
236 73 878 $class eq 'nth-of-type' || $class eq 'nth-last-of-type' ? :
239 336 615 if $class eq 'nth-last-child' or $class eq 'nth-last-of-type'
243 1167 2989 if (my $result = $args->[0] * $i + $args->[1]) < 1
244 178 2811 unless my $sibling = $siblings[$result - 1]
245 400 2411 if $sibling eq $current
257 903 35 $tree->[0] eq 'root' ? :
259 8504 5653 unless $current->[0] eq 'tag'
262 4196 1457 unless _match($group, $current, $tree)
263 493 964 $one ? :
266 43 402 $one ? :
276 5884 2587 if ($type eq 'tag') { }
1124 1463 elsif ($type eq 'attr') { }
1463 0 elsif ($type eq 'pc') { }
277 2827 3057 if defined $s->[1] and not $current->[1] =~ /$s->[1]/
278 18 3039 if defined $s->[2] and not _namespace($s->[2], $current)
282 738 386 unless _attr(@$s[1, 2], $current)
285 847 616 unless _pc(@$s[1, 2], $current)
299 76 191 if $sibling eq $current
302 110 81 if ($immediate) { }
305 25 56 if _combinator($selectors, $sibling, $tree, $pos)
315 191 901 $parent->[0] eq 'root' ? :
317 93 999 if defined $type
323 1297 2134 unless defined(my $value = shift())
339 48 337 unless defined $value
340 8 329 $insensitive ? :
343 63 274 if $op eq '~'
346 10 264 if $op eq '|'
349 11 253 if $op eq '*'
352 30 223 if $op eq '^'
355 31 192 if $op eq '$'