Branch Coverage

lib/CSS/Inliner.pm
Criterion Covered Total %
branch 81 182 44.5


line true false branch
57 81 2145 if defined $value
98 0 2 if (defined $params->{'html_tree'} and $params->{'html_tree'} and ref $params->{'html_tree'} ne "HTML::TreeBuilder")
104 0 0 if (defined $params->{'html_tree'} and $params->{'html_tree'} and defined $params->{'relaxed'} and $params->{'relaxed'})
122 2 26 defined $params->{'html_tree'} ? :
2 26 defined $params->{'strip_attrs'} && $params->{'strip_attrs'} ? :
1 27 defined $params->{'relaxed'} && $params->{'relaxed'} ? :
3 25 defined $params->{'leave_style'} && $params->{'leave_style'} ? :
0 28 defined $params->{'warns_as_errors'} && $params->{'warns_as_errors'} ? :
0 28 defined $params->{'agent'} && $params->{'agent'} ? :
0 28 eval { do { require Encoding::FixLatin; return 1 } } ? :
0 28 defined $params->{'encode_entities'} && $params->{'encode_entities'} ? :
0 28 defined $params->{'ignore_style_type_attr'} && $params->{'ignore_style_type_attr'} ? :
162 0 1 unless ($params and $params->{'url'})
172 0 0 if ($charset) { }
178 0 0 if ($self->_fixlatin) { }
221 0 1 unless ($params and $params->{'filename'})
225 0 1 unless open FILE, "<", $params->{'filename'}
231 1 0 if ($charset) { }
237 0 0 if ($self->_fixlatin) { }
279 0 27 unless ($params and $params->{'html'})
283 0 27 if ($params and $params->{'charset'} and not &find_encoding($params->{'charset'}))
327 0 1 unless ($params and $params->{'content'})
332 1 0 if (exists $params->{'charset'} and $params->{'charset'} and &find_encoding($params->{'charset'})) { }
0 0 elsif (exists $params->{'ctcharset'} and $params->{'ctcharset'} and &find_encoding($params->{'ctcharset'})) { }
344 0 0 if ($meta_charset and &find_encoding($meta_charset)) { }
375 0 1 unless ($params and $params->{'content'})
379 0 1 unless ($params and $params->{'charset'})
391 0 1 unless ($decoded_html)
413 0 27 unless ($self->_html and $self->_html_tree)
421 27 0 if (defined $self->_css) { }
435 11 173 unless exists $entry->{'selector'} and $entry->{'declarations'}
441 38 135 if ($selector =~ /(?:^|[\w\._\*\]])::?(?:([\w\-]+))\b/io and not $1 =~ /first-child|last-child/i)
447 0 135 if ($selector =~ /^\@/io)
459 0 135 if ($@)
490 0 95 unless $CSS::Inliner::a->{'specificity'} <=> $CSS::Inliner::b->{'specificity'}
501 8 165 if (defined $element->attr("style"))
502 0 8 $self->_encode_entities ? :
517 0 173 $self->_encode_entities ? :
545 0 135 unless ($self->_query)
563 1 157 unless ($self->_query)
600 0 3434 unless (ref $self)
612 0 40 if ($self->_warns_as_errors) { }
634 1 27 if ($self->_relaxed)
665 1 0 unless ($res->is_success)
670 0 0 if ($res->content_type ne "text/html" and $res->content_type ne "text/css")
713 0 0 unless ref $i eq "HTML::Element"
715 0 0 if ($i->tag eq 'img' or $i->tag eq 'frame' or $i->tag eq 'input' or $i->tag eq 'script') { }
0 0 elsif ($i->tag eq 'form' and $base) { }
0 0 elsif ($i->tag eq 'a' || $i->tag eq 'area' || $i->tag eq 'link' and $i->attr('href') and not $i->attr('href') =~ /^\#/) { }
0 0 elsif ($i->tag eq 'td' and $i->attr('background') and $base) { }
717 0 0 if ($i->attr("src") and $base)
733 0 0 $base ? :
744 0 0 if (defined $i->content)
770 0 0 if ($self->_relaxed) { }
790 0 0 defined $i->attr('rel') ? :
791 0 0 defined $i->attr('type') ? :
792 0 0 defined $i->attr('href') ? :
795 0 0 unless $rel eq "stylesheet" or $type eq "text/css" or $href =~ /\.css$/
802 0 0 $self->_ignore_style_type_attr ? :
818 0 0 $self->_ignore_style_type_attr ? :
836 1 26 if ($self->_relaxed) { }
853 1 25 if (scalar @html_nodes == 0) { }
0 25 elsif (scalar @html_nodes > 1) { }
860 0 26 if (scalar @head_nodes > 1)
864 0 26 if (scalar @body_nodes > 1)
871 0 0 defined $i->attr('rel') && $i->attr('rel') ? :
872 0 0 defined $i->attr('type') && $i->attr('type') ? :
873 0 0 defined $i->attr('href') && $i->attr('href') ? :
877 0 0 if ($rel eq "stylesheet" or $type eq "text/css" or $href =~ /.css$/)
885 26 0 if ($body)
887 0 26 $self->_ignore_style_type_attr ? :
889 0 26 if (scalar @spurious_style)
906 1 26 $self->_relaxed ? :
909 0 27 $self->_ignore_style_type_attr ? :
913 27 0 if ($i->tag eq "style" and !$i->attr('media') || $i->attr('media') =~ /\b(all|screen)\b/)
924 24 3 unless ($self->_leave_style)
938 351 27 exists $params->{'content'} ? :
942 259 380 unless ref $i and $i->isa("HTML::Element")
944 174 206 if ($i->attr("style"))
947 0 174 $self->_encode_entities ? :
960 54 415 if $exist{$property}++
965 0 174 $self->_encode_entities ? :
969 17 363 if ($self->_strip_attrs)
975 351 29 if (defined $i->content)
987 0 0 unless $warning =~ /^Parsing of undecoded UTF-8/
998 0 0 if ($head)
1004 0 0 if ($meta_equiv_charset_elem)
1008 0 0 if ($meta_equiv_content =~ /charset(?:\s*)=(?:\s*)([\w!#$%&'\-+^`{}~]+)/i)
1013 0 0 if (not defined $meta_charset and $meta_charset_elem)
1057 0 480 unless (/^\s*([\w._-]+)\s*:\s*(.*?)\s*$/)
1073 1 465 if ($value =~ /!\s*important\s*$/i)