View Single Post
Old Today, 01:50 AM   #147
Kayadelenium
Enthusiast
Kayadelenium rocks like Gibraltar!Kayadelenium rocks like Gibraltar!Kayadelenium rocks like Gibraltar!Kayadelenium rocks like Gibraltar!Kayadelenium rocks like Gibraltar!Kayadelenium rocks like Gibraltar!Kayadelenium rocks like Gibraltar!Kayadelenium rocks like Gibraltar!Kayadelenium rocks like Gibraltar!Kayadelenium rocks like Gibraltar!Kayadelenium rocks like Gibraltar!
 
Posts: 44
Karma: 100000
Join Date: Jul 2026
Location: Planet Earth
Device: Kobo Forma
Quote:
Originally Posted by Doitsu
I noticed one more EPUB2/EPUB3 false positive:

<link href="stylesheet.css" media="all" rel="stylesheet" type="text/css"/>

epubveri:ERROR RSC-005: attribute "media" is not allowed here
Confirmed, and fixed in 0.9.3, which is out now. Thank you — and as usual your report was quite a bit bigger than it looked.

I didn't just add media. I built one minimal EPUB per attribute in epubcheck's own link lists and ran them all, which is how far it actually went:
  • EPUB 2 — 3 of the 7 attributes XHTML 1.1 allows on link were rejected: charset, hreflang, media.
  • EPUB 315 of 19: media, hreflang, as, integrity, referrerpolicy, crossorigin, color, disabled, scope, updateviacache, workertype, imagesrcset, imagesizes, fetchpriority, blocking.
  • And the same bug on <style media="…"> in EPUB 3 (plus blocking). The EPUB 2 half of that one I'd fixed back in 0.8.3 and never checked the EPUB 3 copy.

Why it hid for so long, which I thought you'd find more interesting than the fix: my link rule never listed rel at all. It was passing only because RDFa grants rel to every element — so the universal <link rel="stylesheet" href="…"> validated fine, and nothing looked wrong until somebody put a second attribute on it. An accidental grant that happens to cover the common case is worse than no grant, because it removes the signal. rel is now declared properly.

One thing I want to flag because it would have been the easy wrong fix: the two legal sets are not nested. XHTML 1.1 has charset and rev; HTML5 dropped both and added the fifteen. So I split the rule per version rather than granting the union — the union would have made your test case pass while quietly letting each version accept the other's attributes.

Two things I deliberately did not change, in case you run into them:
  • sizes on a link without rel="icon" still errors. That is not my rule — it's epubcheck's own Schematron assert (epub-xhtml-30.sch), and it lives outside the grammar, so widening the attribute list didn't touch it. I've pinned it with a test so a future widening can't silently remove it.
  • epubcheck makes rel required on an EPUB 3 link. I've left it optional for now. Making it required means reporting something I don't report today, and I'd rather measure that separately than smuggle it into a false-positive fix. If you think that's the wrong call, say so.

For what it's worth on how useful this was: neither of my two test instruments could have caught it. epubcheck's own test corpus contains no fixture with <link media> anywhere, and a scan of 255 real EPUBs on this machine found zero uses of it or <style media>. It's perfectly legal and apparently almost nobody writes it — which is exactly the kind of thing that only ever surfaces from someone actually making books.
Kayadelenium is offline   Reply With Quote