Skip to content

CSS-008 on an empty declaration in a stylesheet — issue #238 was fixed for style attributes only #1680

Closed

Description

@bariskayadelen

A stray semicolon in a declaration block is reported as a parse error when it
appears in a stylesheet, but not when it appears in a style attribute.

ERROR(CSS-008): EPUB/s.css(1,9): An error occurred while parsing the CSS:
Token ";" not allowed here, expecting a property name.

This was already accepted and fixed, for one path

#238 (2013) reports the same
message with the same reasoning — that CSS's declaration production matches
empty, so a declaration list may begin with ;. It was marked Accepted and
closed as Fixed by r450.

That fix is still working. Against 5.3.0, in a style attribute:

attribute value result
;color:#000000 no error ← the #238 fix
color:#000000 no error
color: CSS-008
nonsense{{{ CSS-008

So the attribute path is still parsed and still reports genuinely malformed
values — it simply tolerates the empty declaration, correctly. The stylesheet
path does not:

a:link {;color: #000000}     /* CSS-008 at 1,9  */
a:link {color: #000;;}       /* CSS-008 at 1,21 */

Why the tolerant behaviour is the right one

CSS Syntax Level 3 discards the token explicitly. In both 5.4.4 Consume a
style block's contents
and 5.4.5 Consume a list of declarations, the step for
<semicolon-token> is:

Do nothing.

CSS 2.1's core grammar (Appendix G) makes each declaration slot optional:

ruleset
  : selector [ ',' S* selector ]*
    '{' S* declaration? [ ';' S* declaration? ]* '}' S*
  ;

Impact

CSS-008 is an ERROR, so it changes the verdict: a publication that is otherwise
completely clean fails the check because of a character that has no effect on
rendering. It occurs in the wild — the case that prompted this is a
commercially distributed EPUB whose stylesheet contains
a:link {;color: #000000;text-decoration: none;} and which is otherwise clean.

Reproduction

A minimal EPUB 3 whose only stylesheet is a:link {;color: #000000} reports
0 fatals / 1 error. Removing the single ; and changing nothing else reports
No errors or warnings detected.

Where it comes from

CSSHandler.error() turns any exception from the CSS parser into CSS-008
unconditionally, so this surfaces the tokenizer's strictness rather than a rule
the checker decided on. Consistent with that, no CSS-008 scenario in
content-document-css.feature covers this shape — content-css-syntax-error
is about unterminated blocks, which really are malformed.

Activity

  1. self-assigned this
    on Aug 28, 2026
  2. added
    type: improvementThe issue suggests an improvement of an existing feature
    status: needs reviewNeeds to be reviewed by a team member before further processing
    on Aug 28, 2026
  3. added
    status: in progressThe issue is being implemented by the development team
    and removed
    type: improvementThe issue suggests an improvement of an existing feature
    on Sep 13, 2026
  4. rdeltour commented on Sep 14, 2026

    @rdeltour
    Member

    Thanks for the report, good catch! This is fixed in #1719.

    Note that the bespoke CSS parser used by EPUBCheck is quite old now and not fully compliant with CSS Syntax Module Level 3… Some syntax issues like these come up from time to time and we try our best to fix them, but at some point I hope to use a fully conforming parser instead.

  5. added
    status: has PRThe issue is being processed in a pull request
    type: false-positiveThis issue is about valid content being incorrectly rejected
    and removed
    status: in progressThe issue is being implemented by the development team
    status: needs reviewNeeds to be reviewed by a team member before further processing
    on Sep 14, 2026
  6. added a commit that references this issue on Sep 15, 2026
    f4cbac9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

status: has PRThe issue is being processed in a pull requesttype: false-positiveThis issue is about valid content being incorrectly rejected

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    ⌂ 换网址