}
}
- var position = tokens[0] && tokens[0].kind == 'at-rule' && tokens[0].value.indexOf('@charset') === 0 ? 1 : 0;
+ var position = 0;
+ var isCharsetFirst = tokens[0] && tokens[0].kind == 'at-rule' && tokens[0].value.indexOf('@charset') === 0;
+ var isCommentFirst = !isCharsetFirst && tokens[0] && tokens[0].kind == 'text' && tokens[0].value.indexOf('__ESCAPED_COMMENT_SPECIAL') === 0;
+ var isCommentSecond = isCharsetFirst && tokens[1] && tokens[1].kind == 'text' && tokens[1].value.indexOf('__ESCAPED_COMMENT_SPECIAL') === 0;
+
+ if (isCharsetFirst || isCommentFirst)
+ position = 1;
+ if (isCommentSecond)
+ position = 2;
+
for (i = 0; i < movedProperties.length; i++) {
dropPropertiesAt(position, movedProperties[i]);
}
+/*! normalize.css 2012-01-31T16:06 UTC - http://github.com/necolas/normalize.css */
small,sub,sup{font-size:75%}
.alpha,.ie .une_normale .liste_carre_999.liste_une .ie_impair,.liste_carre_999.liste_une li:nth-child(2n+3){clear:left}
.clear,.clearfix:after,.deplier{visibility:hidden}
.btn:hover,.btn_abo:hover,.btn_fonce:hover,.btn_petit:hover,.conteneur_pagination .next:hover,.conteneur_pagination .prev:hover{-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-ms-transition:background-position .1s linear}
-/*! normalize.css 2012-01-31T16:06 UTC - http://github.com/necolas/normalize.css */
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}
audio,canvas,video{display:inline-block}
[hidden],audio:not([controls]){display:none}
var SelectorsOptimizer = require('../../lib/selectors/optimizer');
var Stringifier = require('../../lib/selectors/stringifier');
var Compatibility = require('../../lib/utils/compatibility');
+var SourceTracker = require('../../lib/utils/source-tracker');
function optimizerContext(group, specs, options) {
var stringifier = new Stringifier(false, function (data) { return data; });
options.shorthandCompacting = true;
options.restructuring = true;
options.compatibility = new Compatibility(options.compatibility).toOptions();
+ var outerContext = {
+ sourceTracker: new SourceTracker()
+ };
function optimized(target) {
return function (source) {
- assert.equal(new SelectorsOptimizer(options).process(source, stringifier).styles, target);
+ assert.equal(new SelectorsOptimizer(options, outerContext).process(source, stringifier).styles, target);
};
}
'not in vendored keyframes': [
'@-moz-keyframes test{0%{transform:scale3d(1,1,1);opacity:1}100%{transform:scale3d(.5,.5,.5);opacity:1}}',
'@-moz-keyframes test{0%{transform:scale3d(1,1,1);opacity:1}100%{transform:scale3d(.5,.5,.5);opacity:1}}'
+ ],
+ 'with important comment': [
+ '__ESCAPED_COMMENT_SPECIAL_CLEAN_CSS0__a{width:100px}div{color:red}.one{display:block}.two{display:inline;color:red}',
+ '__ESCAPED_COMMENT_SPECIAL_CLEAN_CSS0__.two,div{color:red}a{width:100px}.one{display:block}.two{display:inline}'
+ ],
+ 'with important comment and charset': [
+ '@charset "utf-8";__ESCAPED_COMMENT_SPECIAL_CLEAN_CSS0__a{width:100px}div{color:red}.one{display:block}.two{display:inline;color:red}',
+ '@charset "utf-8";__ESCAPED_COMMENT_SPECIAL_CLEAN_CSS0__.two,div{color:red}a{width:100px}.one{display:block}.two{display:inline}'
]
}, { advanced: true })
)