Subject: | Does not handle full URL in css |
The inliner cannot handle full URLs in CSS.
The problem is in _collapse_inline_styles and the way it splits on ':' - the extra : in the URL
causes this to fail. If line 275 is amended to split just on the first colon, not all of them, then
it works correctly:
diff "dist-version" "fixed-version"
275c275
< my ($key,$value) = split /:/, $pv_pair;
---
Show quoted text
> my ($key,$value) = split /:/, $pv_pair, 2;
Test file attached.
Found and verified on:
Dist: CSS-Inliner-2669
Perl: v5.10.1 (*) built for amd64-freebsd
OS: FreeBSD gurnard.adestra.com 7.2-RELEASE-p2 FreeBSD 7.2-RELEASE-p2
Same result on:
Dist: CSS-Inliner-2669
Perl: v5.10.1 (*) built for darwin-multi-2level
OS: Mac OS X 10.6.4 Darwin mbp13.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23
18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386
Subject: | css_url.t |
#!/usr/bin/perl -w
use strict;
use warnings;
use Test::More;
BEGIN { use_ok( 'CSS::Inliner' ); }
my $inliner = new CSS::Inliner();
my $input = <<IN;
<html>
<head>
<style>
h4 {
background-image: url(http://www.example.com/test.jpg);
}</style>
</head>
<body>
<h4>Test header with background</h4>
</body>
</html>
IN
$inliner->read({html => $input});
my $actual = $inliner->inlinify();
ok ($actual =~ m{url\(http://www.example.com/test.jpg\)}, 'url in style');
done_testing;