var Marker = require('../tokenizer/marker');
var formatPosition = require('../utils/format-position');
+var HTML_COMMENT_PATTERN = /^(?:(?:<!--|-->)\s*)+/;
var RELATION_PATTERN = /[>\+~]/;
var WHITESPACE_PATTERN = /\s/;
var list = [];
var repeated = [];
+ function removeHTMLComment(rule, match) {
+ warnings.push('HTML comment \'' + match + '\' at ' + formatPosition(rule[2][0]) + '. Removing.');
+ return '';
+ }
+
for (var i = 0, l = rules.length; i < l; i++) {
var rule = rules[i];
var reduced = rule[1];
+ reduced = reduced.replace(HTML_COMMENT_PATTERN, removeHTMLComment.bind(null, rule));
+
if (hasInvalidCharacters(reduced)) {
warnings.push('Invalid selector \'' + rule[1] + '\' at ' + formatPosition(rule[2][0]) + '. Ignoring.');
continue;
'body;{body}',
''
],
+ 'html comments': [
+ '<!-- a{color:red} --> p{color:red} <!--div{color:red}--> ',
+ 'a{color:red}p{color:red}div{color:red}'
+ ],
'missing semicolon and brace in the middle': [
'body{color:red a{color:blue;}',
''