Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loosen restrictions on where remote resources can be referenced #1288

Closed
mattgarrish opened this issue Nov 15, 2021 · 5 comments
Closed

Loosen restrictions on where remote resources can be referenced #1288

mattgarrish opened this issue Nov 15, 2021 · 5 comments
Assignees
Labels
spec: EPUB 3.3 Impacting the support of EPUB 3.3 status: completed Work completed, can be closed type: spec The issue is related to a Specification update
Milestone

Comments

@mattgarrish
Copy link
Member

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 w3c/epub-specs#1857

@mattgarrish mattgarrish added the spec: EPUB 3.3 Impacting the support of EPUB 3.3 label Nov 15, 2021
@rdeltour
Copy link
Member

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 rdeltour self-assigned this Nov 15, 2021
@rdeltour rdeltour added this to the v5.0.0-beta-1 milestone Nov 15, 2021
@rdeltour rdeltour added status: in discussion The issue is being discussed by the development team type: spec The issue is related to a Specification update labels Nov 15, 2021
@rdeltour
Copy link
Member

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.

@mattgarrish
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

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 mattgarrish changed the title Restrict where remote resources can be referenced Loosen restrictions on where remote resources can be referenced Dec 17, 2021
@rdeltour rdeltour added status: ready for implem The issue is ready to be implemented status: in progress The issue is being implemented by the development team and removed status: in discussion The issue is being discussed by the development team status: ready for implem The issue is ready to be implemented labels Jan 23, 2022
rdeltour added a commit that referenced this issue Jul 8, 2022
Previously, EPUBCheck only allowed remote resources when they were
used in elements we knew allowed remote resources (e.g. audio, video,
font declaration).

This commit improves this check by first checking that the resource media
type allows remote resources, regardless of where the resource is used.

Fix #1288
@rdeltour rdeltour added status: completed Work completed, can be closed and removed status: in progress The issue is being implemented by the development team labels Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec: EPUB 3.3 Impacting the support of EPUB 3.3 status: completed Work completed, can be closed type: spec The issue is related to a Specification update
Projects
None yet
Development

No branches or pull requests

2 participants