Branch Coverage

lib/CSS/Inliner.pm
Criterion Covered Total %
branch 71 160 44.3


line true false branch
56 81 1563 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 0 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 27 unless ($params and $params->{'html'})
276 0 27 if ($params and $params->{'charset'} and not &find_encoding($params->{'charset'}))
320 0 1 unless ($params and $params->{'content'})
325 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'})) { }
337 0 0 if ($meta_charset and &find_encoding($meta_charset)) { }
368 0 1 unless ($params and $params->{'content'})
372 0 1 unless ($params and $params->{'charset'})
384 0 1 unless ($decoded_html)
406 0 27 unless ($self->_html and $self->_html_tree)
414 27 0 if (defined $self->_css) { }
428 11 173 unless exists $entry->{'selector'} and $entry->{'declarations'}
434 38 135 if ($selector =~ /(?:^|[\w\._\*\]])::?(?:([\w\-]+))\b/io and not $1 =~ /first-child|last-child/i)
440 0 135 if ($selector =~ /^\@/io)
452 0 135 if ($@)
483 0 95 unless $CSS::Inliner::a->{'specificity'} <=> $CSS::Inliner::b->{'specificity'}
494 8 165 if (defined $element->attr('style'))
531 0 135 unless ($self->_query)
549 1 157 unless ($self->_query)
586 0 2852 unless (ref $self)
598 0 40 if ($self->_warns_as_errors) { }
620 1 27 if ($self->_relaxed)
651 1 0 unless ($res->is_success)
656 0 0 if ($res->content_type ne 'text/html' and $res->content_type ne 'text/css')
699 0 0 unless ref $i eq 'HTML::Element'
701 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) { }
703 0 0 if ($i->attr('src') and $base)
719 0 0 $base ? :
730 0 0 if (defined $i->content)
756 0 0 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 26 if ($self->_relaxed) { }
839 1 25 if (scalar @html_nodes == 0) { }
0 25 elsif (scalar @html_nodes > 1) { }
846 0 26 if (scalar @head_nodes > 1)
850 0 26 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 26 0 if ($body)
875 0 26 if (scalar @spurious_style)
892 1 26 $self->_relaxed ? :
899 27 0 if ($i->tag eq 'style' and !$i->attr('media') || $i->attr('media') =~ /\b(all|screen)\b/)
910 24 3 unless ($self->_leave_style)
924 351 27 exists $params->{'content'} ? :
928 259 380 unless ref $i and $i->isa('HTML::Element')
930 174 206 if ($i->attr('style'))
949 17 363 if ($self->_strip_attrs)
955 351 29 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 426 unless (/^\s*([\w._-]+)\s*:\s*(.*?)\s*$/)
1050 1 465 if ($value =~ /!\s*important\s*$/i)