Branch Coverage

blib/lib/CSS/SAC.pm
Criterion Covered Total %
branch 132 276 47.8


line true false branch
149 1 1 if $$options{'DocumentHandler'}
188 0 1 @_ == 2 ? :
201 0 1 @_ == 2 ? :
218 1 0 if ($dh)
256 0 1 @_ == 2 ? :
286 1 0 if ($$options{'string'}) { }
0 0 elsif ($$options{'ioref'}) { }
0 0 elsif ($$options{'filename'}) { }
296 0 0 unless open CSS, "$$options{'filename'}"
307 0 1 if ($$options{'embedded'}) { }
320 0 1 if $$sac[4]{'start_document'}
352 0 45 if ($css =~ s/^\s*\}//) { }
0 45 elsif ($css =~ /^\s*\@/) { }
0 45 elsif ($css =~ s/^\s*-->\s*//) { }
44 1 elsif (my $sel_list = $sac->parse_selector_list(\$css)) { }
0 1 elsif ($css =~ s/^\s+//) { }
354 0 0 if $$sac[4]{'end_media'}
362 0 0 if ($css =~ s/^\s*\@media\s+//i) { }
0 0 elsif ($css =~ s/^\s*\@font-face\s+//i) { }
0 0 elsif ($css =~ s/^\s*\@page\s+//i) { }
366 0 0 if $$sac[4]{'start_media'}
376 0 0 if $$sac[4]{'start_font_face'}
378 0 0 if $$sac[4]{'end_font_face'}
391 0 0 if $$sac[4]{'start_page'}
393 0 0 if $$sac[4]{'end_page'}
412 0 0 if ($css =~ s/^;//) { }
421 0 0 if $$sac[4]{'ignorable_at_rule'}
434 0 44 unless @$sel_list
436 44 0 if $$sac[4]{'start_selector'}
456 0 44 if $$sac[4]{'end_selector'}
467 1 0 unless length $css
475 0 1 if $$sac[4]{'end_document'}
493 1 0 unless $$css =~ s/^\@charset\s+//i
496 0 0 if ($$css =~ s/^($CSS::SAC::RE_STRING)\s*;//) { }
501 0 0 if $$sac[4]{'charset'}
504 0 0 if ($$css =~ s/[^;]*;//) { }
528 0 0 if ($$css =~ s/^url\(//) { }
546 0 0 if ($$css =~ s/^\s*;//) { }
547 0 0 if $$sac[4]{'import_style'}
550 0 0 if ($$css =~ s/[^;]*;//) { }
577 1 0 if (not $$css =~ /^url\(/ and $$css =~ s/^($CSS::SAC::RE_IDENT)\s+//)
582 1 0 if ($$css =~ s/^url\(//) { }
597 1 0 if ($$css =~ s/^\s*;//) { }
600 0 1 unless $prefix
605 1 0 if $$sac[4]{'namespace_declaration'}
608 0 0 if ($$css =~ s/[^;]*;//) { }
633 0 0 unless $$css =~ s/^\s*($CSS::SAC::RE_IDENT(?:\s*,\s*$CSS::SAC::RE_IDENT)*)//
651 0 0 if ($$css =~ s<^((?:(?:\\\\)|(?:\\[^\*])|(?:\\\*)|[^\\])*?)\*/>[]) { }
652 0 0 if $$sac[4]{'comment'}
655 0 0 if ($$css =~ s[.*\*/][]) { }
666 0 284 if defined $ws and defined $$css
686 44 45 if ($$css =~ /^\s*\{/) { }
1 44 elsif (not length $$css) { }
44 0 elsif (my $sel = $sac->parse_simple_selector($css)) { }
687 0 44 unless (@sels)
711 0 0 if ($$css =~ s/[^{]*//) { }
720 1 44 unless @sels
747 46 59 if ($$css =~ /^\s*(?:,|{)/ or not length $$css) { }
19 40 elsif ($$css =~ s/^(?:($CSS::SAC::RE_IDENT|\*)?(\|))?($CSS::SAC::RE_IDENT|\*)//) { }
2 38 elsif ($$css =~ s/^#($CSS::SAC::RE_NAME)//) { }
2 36 elsif ($$css =~ s/^\.($CSS::SAC::RE_IDENT)//) { }
2 34 elsif ($$css =~ s/^::($CSS::SAC::RE_IDENT)//) { }
9 25 elsif (($attr, $$css, undef) = &Text::Balanced::extract_bracketed($$css, q[[]'"], qr/\s*/) and length $attr) { }
10 15 elsif (($args, $$css, $func) = &Text::Balanced::extract_bracketed($$css, q[()'"], qr/:$CSS::SAC::RE_IDENT/) and length $func) { }
11 4 elsif ($$css =~ s/^\:($CSS::SAC::RE_IDENT)//) { }
3 1 elsif ($$css =~ s/^\s*((?:\+|>|~))\s*//) { }
1 0 elsif ($$css =~ s/^\s+//) { }
755 2 17 $3 eq '*' ? :
756 2 17 if (defined $2 and $2 eq '|') { }
757 0 2 if (not $1) { }
0 2 elsif ($1 eq '*') { }
804 0 9 $3 eq '*' ? :
805 1 8 if (defined $2 and $2 eq '|') { }
806 0 1 if (not $1) { }
0 1 elsif ($1 eq '*') { }
822 6 3 if (length $attr)
823 6 0 if ($attr =~ s/^((?:\^|\$|\*|\~|\|)?=)//) { }
831 0 0 if ($$css =~ s/[^;]*;//) { }
842 5 4 if (not $op or $op eq '=') { }
1 3 elsif ($op eq '^=') { }
1 2 elsif ($op eq '$=') { }
0 2 elsif ($op eq '*=') { }
1 1 elsif ($op eq '~=') { }
1 0 elsif ($op eq '|=') { }
843 2 3 defined $value ? :
880 1 9 if (lc $func eq 'lang') { }
1 8 elsif (lc $func eq 'contains') { }
2 6 elsif (lc $func eq 'not') { }
6 0 elsif ($func =~ /^nth-(last-)?((?:child)|(?:of-type))$/i) { }
899 2 4 lc $2 eq 'of-type' ? :
900 2 4 lc $1 eq 'last-' ? :
916 2 9 if (lc $1 eq 'root') { }
1 8 elsif (lc $1 eq 'empty') { }
1 7 elsif (lc $1 eq 'only-child') { }
1 6 elsif (lc $1 eq 'only-of-type') { }
1 5 elsif (lc $1 eq 'first-child') { }
1 4 elsif (lc $1 eq 'last-child') { }
1 3 elsif (lc $1 eq 'first-of-type') { }
1 2 elsif (lc $1 eq 'last-of-type') { }
0 2 elsif (lc $1 eq 'first-line' or lc $1 eq 'first-letter' or lc $1 eq 'selection' or lc $1 eq 'before' or lc $1 eq 'after') { }
988 0 0 if (s/^.*?(,|{)/$1/) { }
1002 29 17 if ($@)
1009 0 46 if ($@)
1018 38 8 if (@tokens)
1020 0 38 unless ($@)
1029 34 12 if ($cond)
1037 4 0 if ($comb)
1039 0 4 if ref $comb
1044 0 4 if ($@)
1046 0 0 if (ref $new_selector) { }
1058 0 4 if ($cond)
1063 1 3 if ($comb eq ' ') { }
1 2 elsif ($comb eq '>') { }
1 1 elsif ($comb eq '+') { }
1 0 elsif ($comb eq '~') { }
1106 4 34 unless ref $$tokens[0]
1112 34 16 if (@conditions)
1131 0 44 unless defined $$css
1166 0 0 unless (@$lu)
1167 0 0 unless length $$css
1168 0 0 if ($$css =~ s/[^;}]*(?:;|\})?//) { }
1187 0 0 if $$sac[4]{'property'}
1218 0 0 if (not length $$css or $$css =~ /^\s*(?:;|!)/ or $att and $$css =~ s/^\s*(?:\))//) { }
0 0 elsif ($$css =~ s[^\s*(,|/)\s*][]) { }
0 0 elsif ($$css =~ s/^\s+//) { }
0 0 elsif ($$css =~ s/^inherit//) { }
0 0 elsif ($$css =~ s/^((?:\+|-)?$CSS::SAC::RE_NUM) (em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%) //xi) { }
0 0 elsif ($$css =~ s/^((?:\+|-)?$CSS::SAC::RE_NUM)($CSS::SAC::RE_IDENT)//) { }
0 0 elsif ($$css =~ s/^((?:\+|-)?$CSS::SAC::RE_NUM)//) { }
0 0 elsif ($$css =~ s/^($CSS::SAC::RE_RANGE)//) { }
0 0 elsif ($$css =~ s/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})//) { }
0 0 elsif ($$css =~ s/^($CSS::SAC::RE_IDENT)\(//) { }
0 0 elsif ($$css =~ s/^($CSS::SAC::RE_IDENT)//) { }
0 0 elsif ($$css =~ s/^($CSS::SAC::RE_STRING)//) { }
1225 0 0 if ($value eq ',') { }
1267 0 0 if ($value =~ /\./) { }
1307 0 0 if ($CSS::SAC::FUNC_MAP{$text}) { }
1355 0 0 if $$css =~ s/^\s*!\s*important//i