W3C home > Mailing lists > Public > www-international@w3.org > January to March 2014

Re: [css-syntax] ISSUE-329: @charset has no effect on stylesheet??

From: Zack Weinberg <zackw@panix.com>
Date: Wed, 22 Jan 2014 14:28:07 -0500
Message-ID: <CAKCAbMg5i6FDG1jog8z=3T5-fvNsFMUa4TwmD2B_YGMpxi-zkQ@mail.gmail.com>
To: www-style list <www-style@w3.org>, www International <www-international@w3.org>
On Wed, Jan 22, 2014 at 2:11 PM, Richard Ishida <ishida@w3.org> wrote:
> PS: I'm curious, however, about why the parsing of the initial bytes is so
> draconian in requiring specific quotes and exactly one space. HTML5 doesn't
> require that, afaict.

It would not be technically difficult for Gecko to bring the special
parser defined at
*closer* to alignment the parser used for @-rules, subject to some
sort of "within the first N bytes" constraint as for HTML.
Concretely, we could make it accept this Perl-style regular expression
without much trouble:

    /\A \s* @charset \s* ( " [^"]+ " | ' [^']+ ' ) \s* ; /ix

where \A means "the very beginning of the style sheet" and \s means [
\r\n\t\f] (consistent with the definitions of "whitespace" and
"newline" elsewhere in the specification).

However, this is still not a perfect match to the main parser -- in
particular comments would still be forbidden before the semicolon --
and I am not aware of any particular *need* to make this change, i.e.
I am not aware of the as-specified parser causing any trouble for
authors.  I could be persuaded otherwise with data (e.g. a scan of the
public Web for @charset constructs which demonstrated that more than a
few of them were written with single quotes, uppercase, or extra
whitespace, and therefore inoperative).

Received on Wednesday, 22 January 2014 19:28:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:41:04 UTC