epubcheck icon indicating copy to clipboard operation
epubcheck copied to clipboard

Loosen restrictions on where remote resources can be referenced

Open mattgarrish opened this issue 4 years ago • 5 comments
trafficstars

The following rules now apply:

  • remote audio only allowed from audio + source elements and the MO audio element
  • remote video only allowed from video + source elements
  • remote fonts only allowed from CSS @font-face rules, @import rules, and the html link element
  • remote data only allowed from scripting API calls (XHR and Fetch)

See https://github.com/w3c/epub-specs/issues/1857

mattgarrish avatar Nov 15 '21 13:11 mattgarrish

I'm not sure I fully understand the above.

  • If a script dynamically adds an audio element referring to remote audio, is that allowed?
  • an alternative non-core media type document cannot use remote audio if it is not also used in HTML, correct?
  • remote audio listed in the manifest, but not referenced in HTML, becomes invalid, correct?
  • remote audio/video cannot be referenced from an object param, unless they also appear in video or audio element, correct?

This all seems a bit overly restrictive to me, I'm not sure I see the reason or what problem it is trying to solve.

rdeltour avatar Nov 15 '21 13:11 rdeltour

Also, I'm not familiar with the state of custom elements in EPUB, so this may not be so relevant, but these restrictions disallow any remote audio/video referenced from custom elements too.

rdeltour avatar Nov 15 '21 14:11 rdeltour

Also, I'm not familiar with the state of custom elements in EPUB

Ya, that's interesting now. They used to be not allowed because they were defined in separate W3C specs. But now that we're referencing the WHATWG document, template is allowed and I believe we also get the WHATWG DOM standard.

but these restrictions disallow any remote audio/video referenced from custom elements too

Ya, that gets kind of quirky. The reference will end up in an audio or video element, at least as I understand how custom elements work, but epubcheck won't know that because the html markup corresponding to the custom element is generated from code or a template at run time.

mattgarrish avatar Nov 15 '21 14:11 mattgarrish

The restrictions were undone, but it appears that epubcheck already restricts where remote resources can be referenced.

Remote audio and video, at least, are only allowed from audio and video elements otherwise you get an error that remote resources must be placed in the OCF.

These restrictions need to be loosened to reflect the specification.

mattgarrish avatar Dec 17 '21 12:12 mattgarrish

It looks like fonts are also restricted.

If I use a stylesheet link declaration or import rule for a Google font, I also get the message about the resource having to be placed in the OCF.

And if I declare a font-face rule in an xhtml doc then epubcheck emits a warning that it couldn't find any remote resources in the file.

mattgarrish avatar Dec 17 '21 12:12 mattgarrish