* Adds better non-adjacent selector merging when body is the same.
* Fixed issue [#158](https://github.com/GoalSmashers/clean-css/issues/158) - adds body-based selectors reduction.
* Fixed issue [#182](https://github.com/GoalSmashers/clean-css/issues/182) - removing space after closing brace.
+* Fixed issue [#357](https://github.com/GoalSmashers/clean-css/issues/357) - non-standard but valid URLs.
[3.0.2 / 2015-01-04](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.1...v3.0.2)
==================
var EscapeStore = require('./escape-store');
var URL_PREFIX = 'url(';
+var UPPERCASE_URL_PREFIX = 'URL(';
var URL_SUFFIX = ')';
var lineBreak = require('os').EOL;
// instead of regexps to speed up the process.
UrlsProcessor.prototype.escape = function (data) {
var nextStart = 0;
+ var nextStartUpperCase = 0;
var nextEnd = 0;
var cursor = 0;
var tempData = [];
for (; nextEnd < data.length;) {
nextStart = data.indexOf(URL_PREFIX, nextEnd);
- if (nextStart == -1)
+ nextStartUpperCase = data.indexOf(UPPERCASE_URL_PREFIX, nextEnd);
+ if (nextStart == -1 && nextStartUpperCase == -1)
break;
+ if (nextStart == -1 && nextStartUpperCase > -1)
+ nextStart = nextStartUpperCase;
+
if (data[nextStart + URL_PREFIX.length] == '"')
nextEnd = data.indexOf('"', nextStart + URL_PREFIX.length + 1);
else if (data[nextStart + URL_PREFIX.length] == '\'')
function normalize(url) {
url = url
+ .replace(/^url/i, 'url')
.replace(/\\?\n|\\?\r\n/g, '')
.replace(/(\s{2,}|\s)/g, ' ')
.replace(/^url\((['"])? /, 'url($1')
'a{background:url("/very/long/\
path")}',
'a{background:url(/very/long/path)}'
+ ],
+ 'uppercase': [
+ 'a{background-image: URL("images/image.png");}',
+ 'a{background-image:url(images/image.png)}'
]
}),
'urls whitespace in compatibility mode': cssContext({