Branch Coverage

blib/lib/MojoMojo/Declaw.pm
Criterion Covered Total %
branch 167 332 50.3


line true false branch
114 0 27 if eval 'use Scalar::Readonly qw(readonly_on);'
711 141 0 if $tags_to_callback
713 141 0 if $attribs_to_callback
718 0 141 if $Opts{'mismatched_tags_to_fix'}
1027 0 141 if $Debug
1029 0 141 if $Debug
1046 0 141 if $HasScalarReadonly
1077 1215 141 if ($I =~ /\G(.*?)</cogs)
1084 592 623 $I =~ m[\G/]cogs ? :
1087 1210 5 if ($I =~ /\G($TagNameRE)/cogs) { }
4 1 elsif ($I =~ /\G(!)((?:\[CDATA\[|(?:--)?\[if|--)?)/cgis) { }
0 1 elsif ($I =~ /\G(\?)/cgs) { }
1090 237 973 $I =~ m[\G([\s/]+)]cogs ? :
1092 0 1210 if $Debug
1096 982 228 if $I =~ /\G>/cogs
1105 228 0 unless defined $1 or defined $4
1111 345 0 if (defined $4 and $4 =~ /^([`"']?)(.*)\1$/s)
1114 0 345 $1 eq '`' ? :
1119 25 320 if $UTF8Input
1120 25 320 if $UTF8Input
1129 0 345 if $Debug
1135 225 3 if ($I =~ m(\G(?:(\s*[/\\]*\s*(?:--)?\s*)?>|([\s/-]*)))cgs)
1136 0 214 $2 ? :
11 214 $1 ? :
1145 2 1208 if (ref $TagOps eq 'CODE') { }
1147 0 2 if $Debug
1157 0 1208 if $Debug
1165 0 1210 unless defined pos $I
1167 0 1210 if $Debug
1170 3 1207 if ($Defang)
1171 0 3 if $Debug
1193 0 4 if $Debug
1198 0 4 $IsCDATA ? :
1204 0 4 if ($CommentDelim =~ /((?:--)?)\[if/)
1206 0 0 if $ConditionalDelim eq ''
1208 0 0 unless ($I =~ /\G[^\]]*\]-->/cgis)
1213 0 4 if $Debug
1223 4 0 if ($I =~ /\G(.*?)(\Q$ClosingCommentDelim\E!?\s*)(>)/cgis or $I =~ /\G(.*?)(--)(>)/cgis) { }
1230 0 4 if ($EndRestartCommentsText and $CommentData =~ s/^(.*?)(>.*)$/$2/s)
1241 4 0 if $CommentData
1242 4 0 if $CommentData
1246 0 4 $EndRestartCommentsText ? :
1260 0 0 unless $I =~ /\G(.*)$/cgs
1274 0 0 if $Debug
1277 0 0 if ($I =~ /\G(.*?\??)>/cgs) { }
1293 1 1214 if (exists $Self->{'AppendOutput'})
1302 0 141 if $Debug
1305 135 6 if $1
1312 141 0 if ($Self->{'Reentrant'} <= 1)
1327 0 141 if ($Debug)
1330 0 0 if grep {$_ > 0;} values %$OpenedTagsCount
1337 4 137 if $UTF8Input
1450 0 2 if $Self->{'Debug'}
1452 1 1 unless ($IsEndTag)
1456 1 0 if ($$HtmlR =~ m[\G(.*?)(?=</script\b)]cgis)
1459 0 1 if $Self->{'Debug'}
1506 0 4 if $Self->{'Debug'}
1509 0 4 if not $IsAttr and $IsEndTag
1516 0 4 if (not $IsAttr) { }
1517 0 0 if (m[\G(.*?)(?=</style\b)]cgis) { }
0 0 elsif (/\G([^<]*)/cgis) { }
1532 4 0 defined $_ ? :
1541 0 4 unless ($IsAttr)
1552 0 4 if $Self->{'Debug'}
1555 4 0 $Naked ? :
1567 0 4 if $Self->{'Debug'}
1568 0 4 if $Self->{'Debug'}
1584 4 0 if $Spaces
1590 0 4 unless $ExtraData{$Selector}
1591 0 0 unless $Spaces or $IsAttr
1594 4 0 if (defined $Selector)
1595 4 0 if defined $BeforeSelector
1597 4 0 if defined $AfterSelector
1598 4 0 if defined $OpenBrace
1599 4 0 if defined $SelectorRule
1600 4 0 if defined $CloseBrace
1601 4 0 if defined $AfterRule
1606 0 4 if $Self->{'Debug'}
1608 4 0 if ($IsAttr) { }
1615 0 0 unless $ClosingStyleTagPresent
1649 0 0 defined $1 ? :
1650 0 0 defined $1 ? :
1661 0 4 if $Self->{'Debug'}
1717 0 4 if $Self->{'Debug'}
1732 0 6 if $Self->{'Debug'}
1742 0 6 if ($Self->{'url_callback'} and $Value =~ /\s*url\(\s*((?:['"])?)(.*?)\1\s*\)/i)
1745 0 0 if $2
1748 0 0 if $Self->{'Debug'}
1749 0 0 $IsAttr ? :
1751 0 0 if $Url
1758 0 0 if $Self->{'Debug'}
1759 0 0 if $UrlOrig
1766 0 6 if $Self->{'Debug'}
1781 4 0 if $Self->{'css_callback'}
1786 0 4 if $Self->{'Debug'} and $#Selectors > $#SelectorRules
1807 6 0 if $$ExtraData{lc $Key}
1810 0 6 if ($k > 0 and not $$ExtraData{lc $Key})
1814 0 0 if defined $PrevExtra[0][4] and not $PrevExtra[0][4] =~ /;/
1830 0 4 if $SelectorsIn->[$Counter] and not $IsAttr
1847 6 0 if $$ExtraData{lc $Key}
1849 0 6 unless $$ExtraData{lc $Key}
1852 6 0 if ($Defang == 2)
1853 6 0 $Value =~ m[^\s*[a-z0-9%!"'`:()#\s.,\/+-]+\s*;?\s*$]i ? :
1857 0 6 $Value =~ /^\s*url\s*\(/i ? :
1858 0 6 $Value =~ /^\s*expression\s*\(/i ? :
1862 0 6 $Defang ? :
1863 0 6 $Defang ? :
1866 6 0 if (defined $Key)
1867 6 0 if defined $KeyPilot
1869 6 0 if defined $Separator
1870 6 0 if defined $QuoteStart
1871 6 0 if defined $Value
1872 6 0 if defined $QuoteEnd
1873 6 0 if defined $ValueEnd
1874 6 0 if defined $ValueTrail
1877 0 6 if $Self->{'Debug'}
1923 0 344 if $Debug
1929 0 344 if $Debug
1932 237 107 if (ref $Tags{$lcTag})
1938 219 125 unless $AttribRule
1939 0 344 if $Debug
1942 124 220 if ($Self->{'url_callback'} and $AttribRule and exists $UrlRules{$AttribRule})
1946 0 124 if $Debug
1951 0 124 unless defined pos $$HtmlR
1955 4 340 if ($lcAttrKey eq 'style')
1956 0 4 if $Debug
1966 61 283 if ($Self->{'attribs_callback'} and exists $Self->{'attribs_to_callback'}{$lcAttrKey})
1969 0 61 if $Debug
1978 175 169 if ($DefangAttrib == 2 and $AttribRule) { }
0 169 elsif (not $AttribRule) { }
1980 0 175 if $Debug
1984 171 4 if (ref $Rule eq 'Regexp' and $AttrValStripped =~ /$Rule/)
1990 0 175 $AttrValStripped =~ /^(javascript:|livescript:|mocha:|vbscript:)/i ? :
1999 0 344 if $Debug
2002 18 326 if $DefangAttrib
2009 30 1178 if (exists $Self->{'tags_to_callback'}{$lcTag})
2010 0 30 if $Debug
2025 0 344 unless ($AttributeHash{$lcAttr})
2026 0 0 if $Debug
2033 18 326 if $Attr->[7]
2040 344 0 if defined $Attr->[4]
2054 0 0 if (defined $Attr->[4]) { }
2067 1177 31 if ($DefangTag == 2 and my $TagOps = $Tags{$lcTag})
2071 1208 0 if ($Self->{'fix_mismatched_tags'} and $DefangTag == 2 || $DefangTag == 0)
2078 148 443 if ($IsEndTag and $Self->{'mismatched_tags_to_fix'}{$lcTag})
2082 0 148 unless $OpenedTagsCount->{$lcTag}
2087 148 0 if ($PreviousOpenedTag eq $lcTag and not $ClosingTags)
2097 0 0 if (my $NestList = $MismatchedTagNest{$PreviousOpenedTag})
2098 0 0 if $NestList->{''} or $NestList->{$lcTag}
2106 0 148 if $ClosingTags
2109 0 0 if ($ClosingTags and @$OpenedTags and $lcTag eq $$OpenedTags[@$OpenedTags - 1])
2117 0 148 unless $Found
2121 164 1044 if (not $IsEndTag and @$OpenedTags)
2124 22 142 if (my $ImplicitTags = $ImplicitOpenTags{$$OpenedTags[@$OpenedTags - 1]})
2135 0 0 if ($Self->{'mismatched_tags_to_fix'}{$Tag})
2146 148 469 if (not $IsEndTag and $Self->{'mismatched_tags_to_fix'}{$lcTag})
2184 0 344 unless defined $AttrVal
2191 9 2 defined $1 && hex $1 < 1114111 && hex $1 != 65535 && !(hex $1 > 55295 && hex $1 < 57344) ? :
2193 0 0 defined $1 && $1 < 1114111 && $1 != 65535 && !($1 > 55295 && $1 < 57344) ? :
2195 0 3 unless $EntityToChar{lc $1}
2202 0 344 if $Self->{'Debug'}
2218 0 0 unless ($Charset)
2231 0 0 unless defined $1 or defined $4
2236 0 0 if ($Attrs{'content'})
2238 0 0 $Attrs{'content'} =~ /charset\s*=\s*([^\s;'"`]+)[\s;'"`]*/i ? :
2246 0 0 $Charset ? :