Skip Menu |

This queue is for tickets about the CSS-Minifier-XS CPAN distribution.

Report information
The Basics
Id: 90879
Status: open
Priority: 0/
Queue: CSS-Minifier-XS

People
Owner: GTERMARS [...] cpan.org
Requestors: soehnlein [...] nureg.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.09
Fixed in: (no value)



Subject: CSS::Minifier::XS breaks hsl()
The W3C specification of the CSS hsl()- and hsla()-color functions says: 'Saturation and lightness are represented as percentages.' (see http://www.w3.org/TR/2003/CR-css3-color-20030514/#hsl-color). CSS::Minifier::XS removes the percentage sign of the saturation value and therefore breaks the hsl()- and hsla()-color-functions. Here is an example: .foo { background-color: hsl(0,50%,50%); } becomes .foo { background-color: hsl(0,50,50%); } which is not valid CSS and browsers ignore the background-color property.
On Thu Nov 28 10:55:06 2013, http://oid.philipp-soehnlein.de/ wrote: Show quoted text
> CSS::Minifier::XS removes the percentage sign of the saturation value > and therefore breaks the hsl()- and hsla()-color-functions. Here is an > example: > .foo { background-color: hsl(0,50%,50%); } > becomes > .foo { background-color: hsl(0,50,50%); }
Philipp, I'm trying to reproduce this with the CSS that you've provided, but am unable to do so w/v0.09. Took your CSS, created a pair of new files in "t/css/", and then ran the "t/02-minify.t" test, and it came out as expected (with the percentage on both of the 50s). I've attached the files I have to this ticket. If you would be kind enough to download v0.09, and drop these files into the "t/css/" directory, run "perl Build.PL; ./Build; prove -bv t/02-minify.t", and attach the output back here, I'd appreciate it greatly.
Subject: zero-units-commafied.css
/* "zero" should only be dropped on the first value, not the comma-fied ones */ .foo { background-color: hsl(0,50%,50%); }
Subject: zero-units-commafied.min
Download zero-units-commafied.min
application/octet-stream 38b

Message body not shown because it is not plain text.

You are right, my provided test case was wrong, because I thought it happens to the second value everytime. Actually the problem is, when the second (or the third) value is zero, the percent sign must still be there. I tested this behaviour in Firefox 26, Safari 5.1.10, Chrome 31 and Opera 18 and every one of these browsers drop the background-color declaration if the percent sign is missing for the second and third value, even if its zero. Browsers probably behave like that because the specification says "Saturation and lightness are represented as percentages." Find attached some updated test files.
Subject: zero-units-commafied.css
/* "zero" should only be dropped on the first value, not the comma-fied ones */ .foo { background-color: hsl(0,50%,50%); } .bar { background-color: hsl(0,0%,50%); } .baz { background-color: hsl(0,50%,0%); } .foo_alpha { background-color: hsla(0,50%,50%); } .bar_alpha { background-color: hsla(0,0%,50%); } .baz_alpha { background-color: hsla(0,50%,0%); }
Subject: zero-units-commafied.min
Download zero-units-commafied.min
application/octet-stream 240b

Message body not shown because it is not plain text.