[Bps-public-commit] HTML-RewriteAttributes branch, master, updated. d2704eb441d9783569e95cd2ae577a755687c1cd

Alex Vandiver alexmv at bestpractical.com
Mon Dec 12 11:07:11 EST 2011


The branch, master has been updated
       via  d2704eb441d9783569e95cd2ae577a755687c1cd (commit)
      from  c9b34cb391d36c4417283f87856c980f093d266f (commit)

Summary of changes:
 lib/HTML/RewriteAttributes/Resources.pm |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit d2704eb441d9783569e95cd2ae577a755687c1cd
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Dec 12 11:06:32 2011 -0500

    Don't always assume that the attributes we want exist
    
    Otherwise, this codepath warns on <style> tags with no type=, for
    example.

diff --git a/lib/HTML/RewriteAttributes/Resources.pm b/lib/HTML/RewriteAttributes/Resources.pm
index e17cc39..2bb8f6c 100644
--- a/lib/HTML/RewriteAttributes/Resources.pm
+++ b/lib/HTML/RewriteAttributes/Resources.pm
@@ -49,7 +49,7 @@ sub _start_tag {
     my ($tag, $attr, $attrseq, $text) = @_;
 
     if ($self->{rewrite_inline_css_cb}) {
-        if ($tag eq 'link' && $attr->{type} eq 'text/css') {
+        if ($tag eq 'link' and defined $attr->{type} and $attr->{type} eq 'text/css' and defined $attr->{href}) {
             my $content = $self->_import($attr->{href});
             if (defined $content) {
                 $content = $self->_handle_imports($content, $attr->{href});
@@ -57,7 +57,7 @@ sub _start_tag {
                 return;
             }
         }
-        if ($tag eq 'style' && $attr->{type} eq 'text/css') {
+        if ($tag eq 'style' and defined $attr->{type} and $attr->{type} eq 'text/css') {
             $self->{rewrite_look_for_style} = 1;
         }
     }

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list