Branch Coverage

lib/CSS/Inliner.pm
Criterion Covered Total %
branch 86 160 53.7


line true false branch
56 84 1616 if defined $value
93 0 2 if (defined $params->{'html_tree'} and $params->{'html_tree'} and ref $params->{'html_tree'} ne 'HTML::TreeBuilder')
99 0 0 if (defined $params->{'html_tree'} and $params->{'html_tree'} and defined $params->{'relaxed'} and $params->{'relaxed'})
115 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 } } ? :
155 0 1 unless ($params and $params->{'url'})
165 1 0 if ($charset) { }
171 0 0 if ($self->_fixlatin) { }
214 0 1 unless ($params and $params->{'filename'})
218 0 1 unless open FILE, '<', $params->{'filename'}
224 1 0 if ($charset) { }
230 0 0 if ($self->_fixlatin) { }
272 0 28 unless ($params and $params->{'html'})
276 0 28 if ($params and $params->{'charset'} and not &find_encoding($params->{'charset'}))
320 0 2 unless ($params and $params->{'content'})
325 1 1 if (exists $params->{'charset'} and $params->{'charset'} and &find_encoding($params->{'charset'})) { }
1 0 elsif (exists $params->{'ctcharset'} and $params->{'ctcharset'} and &find_encoding($params->{'ctcharset'})) { }
337 0 0 if ($meta_charset and &find_encoding($meta_charset)) { }
368 0 2 unless ($params and $params->{'content'})
372 0 2 unless ($params and $params->{'charset'})
384 0 2 unless ($decoded_html)
406 0 28 unless ($self->_html and $self->_html_tree)
414 28 0 if (defined $self->_css) { }
428 11 180 unless exists $entry->{'selector'} and $entry->{'declarations'}
434 40 140 if ($selector =~ /(?:^|[\w\._\*\]])::?(?:([\w\-]+))\b/io and not $1 =~ /first-child|last-child/i)
440 0 140 if ($selector =~ /^\@/io)
452 0 140 if ($@)
483 0 95 unless $CSS::Inliner::a->{'specificity'} <=> $CSS::Inliner::b->{'specificity'}
494 8 170 if (defined $element->attr('style'))
531 0 140 unless ($self->_query)
549 1 162 unless ($self->_query)
586 0 2960 unless (ref $self)
598 0 42 if ($self->_warns_as_errors) { }
620 1 28 if ($self->_relaxed)
651 0 1 unless ($res->is_success)
656 0 1 if ($res->content_type ne 'text/html' and $res->content_type ne 'text/css')
699 3 10 unless ref $i eq 'HTML::Element'
701 0 10 if ($i->tag eq 'img' or $i->tag eq 'frame' or $i->tag eq 'input' or $i->tag eq 'script') { }
0 10 elsif ($i->tag eq 'form' and $base) { }
1 9 elsif ($i->tag eq 'a' || $i->tag eq 'area' || $i->tag eq 'link' and $i->attr('href') and not $i->attr('href') =~ /^\#/) { }
0 10 elsif ($i->tag eq 'td' and $i->attr('background') and $base) { }
703 0 0 if ($i->attr('src') and $base)
719 1 0 $base ? :
730 9 1 if (defined $i->content)
756 0 1 if ($self->_relaxed) { }
776 0 0 defined $i->attr('rel') ? :
777 0 0 defined $i->attr('type') ? :
778 0 0 defined $i->attr('href') ? :
781 0 0 unless $rel eq 'stylesheet' or $type eq 'text/css' or $href =~ /\.css$/
822 1 27 if ($self->_relaxed) { }
839 1 26 if (scalar @html_nodes == 0) { }
0 26 elsif (scalar @html_nodes > 1) { }
846 0 27 if (scalar @head_nodes > 1)
850 0 27 if (scalar @body_nodes > 1)
857 0 0 defined $i->attr('rel') && $i->attr('rel') ? :
858 0 0 defined $i->attr('type') && $i->attr('type') ? :
859 0 0 defined $i->attr('href') && $i->attr('href') ? :
863 0 0 if ($rel eq 'stylesheet' or $type eq 'text/css' or $href =~ /.css$/)
871 27 0 if ($body)
875 0 27 if (scalar @spurious_style)
892 1 27 $self->_relaxed ? :
899 28 0 if ($i->tag eq 'style' and !$i->attr('media') || $i->attr('media') =~ /\b(all|screen)\b/)
910 25 3 unless ($self->_leave_style)
924 360 28 exists $params->{'content'} ? :
928 261 390 unless ref $i and $i->isa('HTML::Element')
930 179 211 if ($i->attr('style'))
949 17 373 if ($self->_strip_attrs)
955 360 30 if (defined $i->content)
967 0 0 unless $warning =~ /^Parsing of undecoded UTF-8/
978 0 0 if ($head)
984 0 0 if ($meta_equiv_charset_elem)
988 0 0 if ($meta_equiv_content =~ /charset(?:\s*)=(?:\s*)([\w!#$%&'\-+^`{}~]+)/i)
993 0 0 if (not defined $meta_charset and $meta_charset_elem)
1035 0 436 unless (/^\s*([\w._-]+)\s*:\s*(.*?)\s*$/)
1050 1 475 if ($value =~ /!\s*important\s*$/i)