Branch Coverage

blib/lib/CSS/DOM/Parser.pm
Criterion Covered Total %
branch 162 232 69.8


line true false branch
92 0 1991 unless defined $_[0]
106 127 6840 if ($tokens =~ /'\z/) { }
75 6765 elsif ($tokens =~ /u\z/) { }
107 14 113 if $tokens[-1] =~ /^(')[^'\\]*(?:\\.[^'\\]*)*\z | ^(")[^"\\]*(?:\\.[^"\\]*)*\z/sx
121 6 69 if $str_delim and not $copy =~ s/^['"]$_optspace//o
123 14 61 unless $copy
127 0 1991 if pos $_ and pos $_ < length $_
141 59 12 $1 eq '{' ? :
3 71 $1 eq '[' ? :
185 1 1053 unless $types =~ /^s?(?:$any_re|$block_re|\@s?)*\z/
195 22 52 if ($args{('encoding_hint', 'decode')[exists $args{'decode'}]})
197 0 22 unless defined $src
199 22 52 defined $src ? :
204 20 83 if s/^([s<]+)//
207 44 59 if (/^@/) { }
216 10 86 if ($tokcount == @$tokens)
217 9 1 if $types
230 14 163 if s/^s//
232 146 31 if (/^@/) { }
237 2 29 unless $stmt = _parse_ruleset($_, $tokens, $_[1])
244 7 170 length $types ? :
177 0 unless $@
254 2 396 if $tokens[0] =~ s/^s//
255 397 1 (my $style = _parse_style_declaration(@tokens, undef, @_[1 .. $#_])) && !$tokens[0] ? :
271 66 124 if ($unesc_at eq '@media' and s/^(s?is?(?:,s?is?)*\{)//) { }
22 102 elsif ($unesc_at eq '@page' and s/^((?:s?:i)?)(s?{s?)// or $unesc_at eq '@font-face' and s/^()(s?{s?)//) { }
43 59 elsif ($unesc_at eq '@import' and s/^s?([u'])s?(is?(?:,s?is?)*)?(?:;s?|\z)//) { }
22 37 elsif ($at eq '@charset' and @$tokens >= 3 and $tokens->[0] eq ' ' and $tokens->[1] =~ /^"/ and s/^s';s?//) { }
287 66 0 "{$_" =~ /^$block_re/ ? :
297 31 35 if s/^s//
303 49 17 if (s/^}s?//) { }
319 0 17 if $body =~ /"/
322 1 16 $length ? :
325 5 12 if $body =~ s/s\z//
354 20 2 if ($style) { }
355 20 0 if s/^}s?//
356 12 8 if $class eq 'Page'
361 2 0 unless "{$_" =~ /^$block_re/
368 0 0 if $selector =~ /"/
370 0 0 if $selector =~ s/s\z//
385 5 38 $2 ? :
390 38 5 unless @media_tokens
411 5 32 unless s/^(s?(??{ $any_re; })*(?:(??{ $block_re; })|(?:;s?|\z)))//
414 1 31 if $types =~ /"/
415 8 23 if $types =~ s/s\z//
427 78 106 unless s/(^($any_re*)\{s?(?:$any_re|$block_re|[\@;]s?)*}s?)//x
430 1 105 unless index($2, '"') == -1
438 105 0 if s/^{s?//
443 105 0 if s/^}s?//
452 78 27 if (s/^($any_re+)//)
456 38 67 if $selector =~ s/s\z//
465 2 523 unless /^(?:$any_re|$block_re|[\@;]s?)*(?:}s?|\z)/x
471 633 54 if (s/^is?:s?((?:$any_re|$block_re|\@s?)+)//) { }
21 33 elsif (s/^;s?//) { }
475 631 2 unless ($types =~ /"/)
476 45 586 if $types =~ s/s\z//
481 142 491 if s/^;s?//
490 1 32 if s/^;s?//
500 3 6 10 < $#$tokens ? :
3 6 $#$tokens > 10 ? :
510 0 22 if (/^(\xef\xbb\xbf(\@charset "(.*?)";)\005)/s) { }
2 20 elsif (/^\xef\xbb\xbf/) { }
0 20 elsif (/^(\@charset "(.*?)";)\005/s) { }
0 20 elsif (/^(\xfe\xff(\0\@\0c\0h\0a\0r\0s\0e\0t\0 \0"((?:\0.)*?)\0"\0;)\005)/s) { }
1 19 elsif (/^(\0\@\0c\0h\0a\0r\0s\0e\0t\0 \0"((?:\0.)*?)\0"\0;)/s) { }
1 18 elsif (/^(\xff\xfe(\@\0c\0h\0a\0r\0s\0e\0t\0 \0"\0((?:.\0)*?)"\0;\0))/s) { }
1 17 elsif (/^(\@\0c\0h\0a\0r\0s\0e\0t\0 \0"\0((?:.\0)*?)"\0;\0)/s) { }
1 16 elsif (/^(\0\0\xfe\xff(\0{3}\@\0{3}c\0{3}h\0{3}a\0{3}r\0{3}s\0{3}e\0{3}t \0{3}\ \0{3}"((?:\0{3}.)*?)\0{3}"\0{3};))/sx) { }
1 15 elsif (/^(\0{3}\@\0{3}c\0{3}h\0{3}a\0{3}r\0{3}s\0{3}e\0{3}t \0{3}\ \0{3}"((?:\0{3}.)*?)\0{3}"\0{3};)/sx) { }
1 14 elsif (/^(\xff\xfe\0\0(\@\0{3}c\0{3}h\0{3}a\0{3}r\0{3}s\0{3}e\0{3}t \0{3}\ \0{3}"\0{3}((?:.\0{3})*?)"\0{3};\0{3}))/sx) { }
1 13 elsif (/^(\@\0{3}c\0{3}h\0{3}a\0{3}r\0{3}s\0{3}e\0{3}t \0{3}\ \0{3}"\0{3}((?:.\0{3})*?)"\0{3};\0{3})/sx) { }
2 11 elsif (/^(?:\0\0\xfe\xff|\xff\xfe\0\0)/) { }
3 8 elsif (/^(?:\xfe\xff|\xff\xfe)/) { }
2 6 elsif (/^(\|\x83\x88\x81\x99\xa2\x85\xa3\@\x7f(.*?)\x7f\^)/s) { }
1 5 elsif (/^(\xae\x83\x88\x81\x99\xa2\x85\xa3\@\xfc(.*?)\xfc\^)/s) { }
1 4 elsif (/^(\0charset "(.*?)";)/s) { }
513 0 0 if (defined $dec)
514 0 0 $1 ? :
0 0 if $dec =~ /^(\x{feff}?)$2\z/
517 0 0 $1 ? :
527 0 0 if (defined $dec)
528 0 0 if $dec eq $1
539 0 0 if (defined $dec)
540 0 0 $1 ? :
0 0 if $dec =~ /^(\x{feff}?)\@charset "$enc";\z/
543 0 0 $1 ? :
554 1 0 unless defined $dec
555 1 0 if (defined $dec)
556 1 0 if $dec eq qq[\@charset "$origenc";]
567 1 0 if (defined $dec)
568 0 1 $1 ? :
1 0 if $dec =~ /^(\x{feff}?)\@charset "$enc";\z/
571 0 0 $1 ? :
582 1 0 unless defined $dec and $dec =~ /^\@/
583 1 0 if (defined $dec)
584 1 0 if $dec eq qq[\@charset "$origenc";]
596 1 0 if (defined $dec)
597 0 1 $1 ? :
1 0 if $dec =~ /^(\x{feff}?)\@charset "$enc";\z/
600 0 0 $1 ? :
612 1 0 unless defined $dec
613 1 0 if (defined $dec)
614 1 0 if $dec eq qq[\@charset "$origenc";]
626 1 0 if (defined $dec)
627 0 1 $1 ? :
1 0 if $dec =~ /^(\x{feff}?)\@charset "$enc";\z/
630 0 0 $1 ? :
642 1 0 unless defined $dec and $dec =~ /^\@/
643 1 0 if (defined $dec)
644 1 0 if $dec eq qq[\@charset "$origenc";]
661 2 0 if (defined $dec)
662 2 0 if $dec eq qq[\@charset "$enc";]
673 1 0 if (defined $dec)
674 1 0 if $dec eq qq[\@charset "$enc";]
685 1 0 if (defined $dec)
686 1 0 if $dec eq qq[\@charset "$enc";]