==================
* Fixed issue [#630](https://github.com/jakubpawlowicz/clean-css/issues/630) - vendor prefixed flex optimizations.
+* Fixed issue [#633](https://github.com/jakubpawlowicz/clean-css/issues/633) - handling data URI with brackets.
[3.3.7 / 2015-07-29](https://github.com/jakubpawlowicz/clean-css/compare/v3.3.6...v3.3.7)
==================
var nextStart = 0;
var nextStartUpperCase = 0;
var nextEnd = 0;
+ var nextEndAhead = 0;
var cursor = 0;
var tempData = [];
var hasUppercaseUrl = data.indexOf(UPPERCASE_URL_PREFIX) > -1;
if (nextStart == -1 && nextStartUpperCase > -1)
nextStart = nextStartUpperCase;
- if (data[nextStart + URL_PREFIX.length] == '"')
+ if (data[nextStart + URL_PREFIX.length] == '"') {
nextEnd = data.indexOf('"', nextStart + URL_PREFIX.length + 1);
- else if (data[nextStart + URL_PREFIX.length] == '\'')
+ } else if (data[nextStart + URL_PREFIX.length] == '\'') {
nextEnd = data.indexOf('\'', nextStart + URL_PREFIX.length + 1);
- else
+ } else {
nextEnd = data.indexOf(URL_SUFFIX, nextStart);
+ while (true) {
+ nextEndAhead = data.indexOf(URL_SUFFIX, nextEnd + 1);
+ // if it has whitespace then we should be out of URL, otherwise keep iterating
+ // if it has not but content is not escaped, it has to be quoted so it will be captured
+ // by either of two clauses above
+ if (nextEndAhead == -1 || /\s/.test(data.substring(nextEnd, nextEndAhead)))
+ break;
+
+ nextEnd = nextEndAhead;
+ }
+ }
+
+
// Following lines are a safety mechanism to ensure
// incorrectly terminated urls are processed correctly.
if (nextEnd == -1) {
'keep quoting if whitespace inside @font-face': [
'@font-face{src:url("/Helvetica Neue.eot")}',
'@font-face{src:url(\'/Helvetica Neue.eot\')}'
+ ],
+ 'keep SVG data URI unchanged for background-uri': [
+ 'div{background-image:url(data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2018%2018%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2214%22%20height%3D%2214%22%20transform%3D%22translate(2%202)%22%2F%3E%3C%2Fsvg%3E)}',
+ 'div{background-image:url(data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2018%2018%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2214%22%20height%3D%2214%22%20transform%3D%22translate(2%202)%22%2F%3E%3C%2Fsvg%3E)}'
+ ],
+ 'keep SVG data URI unchanged1 for background': [
+ 'div{background:url(data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2018%2018%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2214%22%20height%3D%2214%22%20transform%3D%22translate(2%202)%22%2F%3E%3C%2Fsvg%3E) bottom left}',
+ 'div{background:url(data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2018%2018%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%2214%22%20height%3D%2214%22%20transform%3D%22translate(2%202)%22%2F%3E%3C%2Fsvg%3E) bottom left}'
]
}, { root: process.cwd(), relativeTo: process.cwd() })
)