Skip to content

Commit

Permalink
Fix for decimal values in @media selectors being stripped of their de…
Browse files Browse the repository at this point in the history
…cimal points.
  • Loading branch information
cfinke authored and Cerdic committed Apr 5, 2012
1 parent d8814b4 commit 695f2c5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions class.csstidy.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,8 @@ function parse($string) {
} elseif ($string{$i} === '\\') {
$this->at .= $this->_unicode($string, $i);
}
// fix for complicated media, i.e @media screen and (-webkit-min-device-pixel-ratio:0)
elseif (in_array($string{$i}, array('(', ')', ':'))) {
// fix for complicated media, i.e @media screen and (-webkit-min-device-pixel-ratio:1.5)
elseif (in_array($string{$i}, array('(', ')', ':', '.'))) {
$this->at .= $string{$i};
}
} else {
Expand Down
27 changes: 27 additions & 0 deletions testing/unit-tests/csst/special/atmedia-decimals.csst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--TEST--
Decimal values in @media selectors should be maintained.
--CSS--
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
#browserHigh {
background-image: url(http://design5279.files.wordpress.com/2012/04/browser-128.png);
}

#internetHigh {
background-image: url(http://design5279.files.wordpress.com/2012/04/internet-128.png);
}
}
--FULLEXPECT--
array (
'@media only screen and (-webkit-min-device-pixel-ratio: 1.5),only screen and (min-device-pixel-ratio: 1.5) ' =>
array (
'#browserHigh' =>
array (
'background-image' => 'url(http://design5279.files.wordpress.com/2012/04/browser-128.png)',
),
'#internetHigh' =>
array (
'background-image' => 'url(http://design5279.files.wordpress.com/2012/04/internet-128.png)',
),
),
)
--SETTINGS--

0 comments on commit 695f2c5

Please sign in to comment.