Skip to content

False-positive with the CSS :not pseudo-class #1354

@jeandeaual

Description

@jeandeaual

With the following content:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en">
  <head>
    <title>CSS test for :not</title>
    <style>
      @namespace epub "http://www.idpf.org/2007/ops";

      :not(nav.class) > h1 {
        color: blue;
      }

      :not(nav[epub|type="landmarks"]) > h1 {
        text-decoration: underline;
      }
    </style>
  </head>
  <body>
    <nav epub:type="toc">
      <h1>Table of Contents</h1>
    </nav>
    <nav epub:type="landmarks">
      <h1>Guide</h1>
    </nav>
  </body>
</html>

EPUBCheck lists these two errors:

Validating using EPUB version 3.2 rules.
ERROR(CSS-008): epubcheck-issue.epub/EPUB/xhtml/epubcheck-issue.xhtml(10,21): An error occurred while parsing the CSS: Token ")" not allowed here.
ERROR(CSS-008): epubcheck-issue.epub/EPUB/xhtml/epubcheck-issue.xhtml(14,25): An error occurred while parsing the CSS: Token "=" not allowed here.

Check finished with errors
Messages: 0 fatals / 2 errors / 0 warnings / 0 infos

EPUBCheck completed

The CSS appears to be correct, so I believe EPUBCheck should not report any errors.

Here's a small EPUB file that reproduces the issue (renamed to .zip, otherwise it wouldn't upload):
epubcheck-issue.zip

Metadata

Metadata

Assignees

Labels

status: completedWork completed, can be closedtype: 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