sabberworm / PHP-CSS-Parser

A Parser for CSS Files written in PHP. Allows extraction of CSS files into a data structure, manipulation of said structure and output as (optimized) CSS

Home Page:http://www.sabberworm.com/blog/2010/6/10/php-css-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unquoted @charset value causes next rule to be dropped

JakeQZ opened this issue · comments

@charset UTF-8;
h1 {
  color: green;
}
p {
  color: green;
}

The rule for h1 gets discarded. (The rule for p is included as expected.) This is an invalid @charset rule (quotes are required for the value), but a reasonable expectation would be for the parser to recover without dropping the next rule. (Same issue if there's an at-rule following.)

If the @charset rule has the required quotes around the value, there is no problem.

@charset "UTF-8";
h1 {
  color: green;
}
p {
  color: green;
}

This is not likely to be an significant issue in the real world, but is something we have found in testing. I am just logging this so that it is captured.