[Bps-public-commit] r11966 - in HTML-RewriteAttributes: . lib/HTML/RewriteAttributes
sartak at bestpractical.com
sartak at bestpractical.com
Tue Apr 29 18:54:35 EDT 2008
Author: sartak
Date: Tue Apr 29 18:54:33 2008
New Revision: 11966
Modified:
HTML-RewriteAttributes/ (props changed)
HTML-RewriteAttributes/lib/HTML/RewriteAttributes/Resources.pm
HTML-RewriteAttributes/t/021-import.t
Log:
r54672 at onn: sartak | 2008-04-29 18:36:06 -0400
Fix <link> to not import CSS we've already imported
Modified: HTML-RewriteAttributes/lib/HTML/RewriteAttributes/Resources.pm
==============================================================================
--- HTML-RewriteAttributes/lib/HTML/RewriteAttributes/Resources.pm (original)
+++ HTML-RewriteAttributes/lib/HTML/RewriteAttributes/Resources.pm Tue Apr 29 18:54:33 2008
@@ -47,7 +47,7 @@
if ($self->{rewrite_inline_css_cb}) {
if ($tag eq 'link' && $attr->{type} eq 'text/css') {
- my $content = $self->{rewrite_inline_css_cb}->($attr->{href});
+ my $content = $self->_import($attr->{href});
if (defined $content) {
$content = $self->_handle_imports($content);
$self->{rewrite_html} .= "\n<style type=\"text/css\">\n<!--\n$content\n-->\n</style>\n";
Modified: HTML-RewriteAttributes/t/021-import.t
==============================================================================
--- HTML-RewriteAttributes/t/021-import.t (original)
+++ HTML-RewriteAttributes/t/021-import.t Tue Apr 29 18:54:33 2008
@@ -2,7 +2,7 @@
use strict;
use warnings;
use HTML::RewriteAttributes::Resources;
-use Test::More tests => 4;
+use Test::More tests => 3;
my $html = << 'END';
<html>
@@ -38,6 +38,13 @@
return $css{$uri};
}, inline_imports => 1);
+is(@seen, 0, "no ordinary resources seen");
+is_deeply(\@seen_css, [
+ "foo.css",
+ "quux.css",
+ "bar.css",
+ "baz.css",
+]);
$rewrote =~ s/ +$//mg;
$rewrote =~ s/^ +//mg;
@@ -58,7 +65,7 @@
<style type="text/css">
<!--
-baz; foo;
+baz;
-->
</style>
More information about the Bps-public-commit
mailing list