function restore(context, data, from, isSpecial) {
var tempData = [];
var cursor = 0;
- var addBreak;
for (; cursor < data.length;) {
var nextMatch = from.nextMatch(data, cursor);
if (isSpecial && (context.keepAll || (context.keepOne && context.restored === 0))) {
context.restored++;
- addBreak = context.keepBreaks && data[nextMatch.end] != '\n' && data.lastIndexOf('\r\n', nextMatch.end + 1) != nextMatch.end;
- tempData.push(comment, addBreak ? lineBreak : '');
+ tempData.push(comment);
+
+ cursor = nextMatch.end;
} else {
- nextMatch.end += context.keepBreaks ? lineBreak.length : 0;
+ cursor = nextMatch.end + (context.keepBreaks && data[nextMatch.end] == lineBreak ? 1 : 0);
}
-
- cursor = nextMatch.end;
}
return tempData.length > 0 ?
-@font-face{src:url(../font/myfont.eot);/*! IE9 */
-/*! IE6-IE8 */
-/*! chrome, firefox */
-/*! chrome, firefox, opera, Safari, Android, iOS 4.2+ */
-src:url(../font/myfont.eot?#iefix) format("embedded-opentype"),url(../font/myfont.woff) format("woff"),url(../font/myfont.ttf) format("truetype"),url(../font/myfont.svg#myfont) format("svg");font-style:normal;font-weight:400}
\ No newline at end of file
+@font-face{src:url(../font/myfont.eot);/*! IE9 *//*! IE6-IE8 *//*! chrome, firefox *//*! chrome, firefox, opera, Safari, Android, iOS 4.2+ */src:url(../font/myfont.eot?#iefix) format("embedded-opentype"),url(../font/myfont.woff) format("woff"),url(../font/myfont.ttf) format("truetype"),url(../font/myfont.svg#myfont) format("svg");font-style:normal;font-weight:400}
\ No newline at end of file
)
.addBatch(
processorContext('zero with breaks', {
- 'content and special comments': [
+ 'remove comment and a break': [
'a{}' + lineBreak + '/*! some text */' + lineBreak + 'p{}',
'a{}' + lineBreak + '__ESCAPED_COMMENT_SPECIAL_CLEAN_CSS0__' + lineBreak + 'p{}',
'a{}' + lineBreak + 'p{}'
)
.addBatch(
processorContext('one with breaks', {
- 'forces break after comments': [
+ 'keeps content as is': [
'a{}/*! some text */p{}',
'a{}__ESCAPED_COMMENT_SPECIAL_CLEAN_CSS0__p{}',
- 'a{}/*! some text */' + lineBreak + 'p{}'
+ 'a{}/*! some text */p{}'
],
- 'if not given already comments': [
+ 'keeps if not given already': [
'a{}/*! some text */' + lineBreak + 'p{}',
'a{}__ESCAPED_COMMENT_SPECIAL_CLEAN_CSS0__' + lineBreak + 'p{}',
'a{}/*! some text */' + lineBreak + 'p{}'