PHP-CSS-Parser icon indicating copy to clipboard operation
PHP-CSS-Parser copied to clipboard

Unquoted @charset value causes next rule to be dropped

Open JakeQZ opened this issue 3 years ago • 1 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;
}

JakeQZ avatar Jun 12 '21 01:06 JakeQZ

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.

JakeQZ avatar Jun 12 '21 01:06 JakeQZ