Branch Coverage

blib/lib/DOM/Tiny/_CSS.pm
Criterion Covered Total %
branch 144 150 96.0


line true false branch
22 871 0 @_ > 1 ? :
871 0 @_ ? :
27 871 0 unless @_
34 1 28 $tree->[0] ne 'tag' ? :
44 82 1281 if $current->[0] eq 'root' or $current eq $tree
45 1076 205 if _combinator($selectors, $current, $tree, $pos)
46 137 68 if $one
57 317 531 unless $name =~ /$name_re/
58 34 497 unless defined $attrs->{$name} and defined $value_re
59 309 188 if $attrs->{$name} =~ /$value_re/
69 0 6877 unless my $c = $selectors->[$pos]
70 6877 0 if (ref $c)
71 4083 2794 unless _selector($c, $current)
72 1402 1392 unless $c = $$selectors[++$pos]
76 874 518 if $c eq '>'
79 45 473 if $c eq '~'
82 52 421 if $c eq '+'
95 1497 1747 unless @$selectors and ref $selectors->[-1]
99 7 3237 if ($css =~ /\G\s*,\s*/cg) { }
592 2645 elsif ($css =~ /\G\s*([ >+~])\s*/cg) { }
131 2514 elsif ($css =~ /\G([.#])((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/cog) { }
197 2317 elsif ($css =~ /\G$ATTR_RE/cog) { }
179 2138 elsif ($css =~ /\G:([\w\-]+)(?:\(((?:\([^)]+\)|[^)])+)\))?/cgs) { }
1240 898 elsif ($css =~ /\G((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/cog) { }
106 41 90 $1 eq '.' ? :
112 94 103 defined $2 ? :
2 103 defined $4 ? :
92 105 defined $3 ? :
127 28 151 if $name eq 'not'
130 98 81 if $name =~ /^nth-/
133 4 175 if $name =~ /^first-(.+)$/
136 12 167 if $name =~ /^last-/
143 1226 14 unless $1 eq '*'
152 56 2 unless $_[0][0] eq 'comment'
155 2 96 unless my $equation = shift()
158 9 87 if $equation =~ /^\s*even\s*$/i
161 12 75 if $equation =~ /^\s*odd\s*$/i
164 24 51 if $equation =~ /^\s*((?:\+|-)?\d+)\s*$/
167 1 50 unless $equation =~ /^\s*((?:\+|-)?(?:\d+)?)?n\s*((?:\+|-)\s*\d+)?\s*$/i
169 6 27 !length($1) ? :
17 33 $1 eq '-' ? :
185 201 1153 if $class eq 'checked'
188 126 1027 if $class eq 'not'
191 24 1003 if $class eq 'empty'
194 47 956 if $class eq 'root'
197 908 48 if (ref $args) { }
40 8 elsif ($class eq 'only-child' or $class eq 'only-of-type') { }
198 73 835 $class =~ /of-type$/ ? :
200 326 582 if $class =~ /^nth-last/
203 1103 2848 if (my $result = $args->[0] * $i + $args->[1]) < 1
204 178 2670 unless my $sibling = $siblings[$result - 1]
205 381 2289 if $sibling eq $current
211 20 20 $class eq 'only-of-type' ? :
223 807 35 $tree->[0] eq 'root' ? :
225 7989 5237 unless $current->[0] eq 'tag'
228 3888 1349 unless _match($group, $current, $tree)
229 418 931 $one ? :
232 35 389 $one ? :
242 2646 2782 unless $current->[1] =~ /$s->[1]/
5428 2335 if ($type eq 'tag') { }
981 1354 elsif ($type eq 'attr') { }
1354 0 elsif ($type eq 'pc') { }
245 638 343 unless _attr(@$s[1, 2], $current)
248 799 555 unless _pc(@$s[1, 2], $current)
259 74 187 if $sibling eq $current
262 108 79 if ($immediate) { }
265 23 56 if _combinator($selectors, $sibling, $tree, $pos)
275 186 859 $parent->[0] eq 'root' ? :
277 93 952 if defined $type
299 27 301 unless defined $value
300 7 294 $insensitive ? :
303 63 238 if $op eq '~'
306 11 227 if $op eq '*'
309 30 197 if $op eq '^'
312 31 166 if $op eq '$'