css-scanner
Advanced tools
@@ -204,3 +204,3 @@ var util = require('util'); | ||
if (!match) { | ||
this._atcharset.checked = true; | ||
this._charsetChecked = true; | ||
return false; | ||
@@ -211,3 +211,3 @@ } else if (/^\s+/.test(match[0])){ | ||
if (this._atcharset.checked) { | ||
if (this._charsetChecked) { | ||
return this._error('@charset must be the first element'); | ||
@@ -225,3 +225,3 @@ } | ||
this.emit('@charset', encoding[0].replace(/^['"]|['"]$/g, '')); | ||
this._atcharset.checked = true; | ||
this._charsetChecked = true; | ||
return true; | ||
@@ -228,0 +228,0 @@ }; |
{ | ||
"name": "css-scanner", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Scanner for css element", | ||
@@ -5,0 +5,0 @@ "main": "css-scanner.js", |
@@ -207,2 +207,15 @@ var assert = require('assert'); | ||
}); | ||
describe('@@charset', function() { | ||
it('Normal', function() { | ||
var content = '@charset "UTF-8";'; | ||
var css = new CssScanner(content); | ||
css.on('@charset', function(name) { | ||
assert.equal(name, 'UTF-8'); | ||
}); | ||
css.scanner(); | ||
}); | ||
}); | ||
}); |
274419
0.1%7078
0.14%