Skip to content

Are fragment identifiers allowed in manifest? #1303

Closed

Description

@dauwhe

See w3c/epubcheck#1085

It appears that href attributes anywhere in the package file must be IRIs.

Each item element in the manifest identifies a Publication Resource by the IRI [RFC3987] provided in its href attribute. The IRI MAY be absolute or relative. In the case of relative IRIs, Reading Systems MUST use the IRI of the Package Document as the base when resolving these to absolute IRIs. The resulting absolute IRI MUST be unique within the manifest scope.

But we don't appear to forbid fragment identifiers. All we say about href is

An absolute or relative IRI reference [RFC3987] to a resource.

EPUBCheck complains loudly about fragment identifiers, I think because it misinterprets them as incorrect file extensions.

I'm not sure if we need to do anything here.

Activity

  1. mattgarrish commented on Oct 29, 2019

    @mattgarrish
    Member

    They should be allowed as they're needed for refines, links, previews, and probably other things.

    There's just no defined reading system support for them, even for refines, I believe.

  2. added
    Agenda+Issues that should be discussed during the next working group call.
    on May 12, 2021
  3. mattgarrish commented on May 13, 2021

    @mattgarrish
    Member

    I didn't realize we had an open issue for this, but I've tried to address this in the PR #1670 for the URL standard.

    The URL standard differentiates "relative-URL string" from "relative-URL-with-fragment string". For manifest items (and media overlay audio elements) I've replaced the general requirement for IRI references with the stricter non-fragment URL strings.

    Is there any case where a manifest resource can be a fragment of another?

    Allowing link elements to reference fragments is fine, though, and we have an example of doing just that (linking to a metadata record embedded in an html doc).

  4. added a commit that references this issue on May 13, 2021
  5. iherman commented on May 14, 2021

    @iherman
    Member

    The issue was discussed in a meeting on 2021-05-13

    List of resolutions:

    • Resolution No. 2: Merge PR 1670, close issue 1303, forbidding fragment identifiers in hrefs for items
    View the transcript

    4. Are fragment identifiers allowed in manifest?

    See github issue #1303.

    Dave Cramer: i made an epub that had fragment identifier in href
    … epubcheck threw an error
    … but not sure which section of the spec this requirement came from
    … so something to think about, especially as we're rewriting the spec to refer to WHATWG URL spec

    Ben Schroeter: would we need to do some epubcheck work if we were to decide to allow these fragment identifiers?

    Dave Cramer: yes, but that shouldn't be an obstacle, not big code change

    Ben Schroeter: any downside? could it be abused?

    Matt Garrish: just curious what the expectation is for RS if it is a fragment? What is RS supposed to do?
    … load then scroll to fragment?
    … and what about only having each resource listed once?

    Dave Cramer: i think this is the same as activating a link in toc, i.e., yes to scroll
    … but not suppress any of the document before the fragment

    Brady Duga: how would that work in the spine? So chapter 1 is beginning of chapter, but chapter 2 is link to middle of the book?

    Dave Cramer: yes, but we could have a note to say not to do that

    Ben Schroeter: is there a legitimate reason to do this?
    … or is this just to fix the epubcheck thing?

    Matt Garrish: suspect this has something to do with the requirement to point to a resource, not a fragment of that resource

    Brady Duga: maybe if you want to skip some kind of chapter heading for each chapter, so that you start with the first paragraph of the chapter?

    Wendy Reid: we've had some cases where the entire book is in a single HTML file
    … so this would allow you to actually navigate to the inside chapters?

    Ben Schroeter: what about the fact that fragments need to be allowed for refines and stuff like that?

    Matt Garrish: that's not in the manifest

    Dave Cramer: a valid reason for changing the spec is to make it match reality, and given that we already enforce this, allowing a fragment here would vastly complicate the responsibilities of an RS
    … i think we just say hrefs in items shouldn't have fragments

    Matt Garrish: and the URL spec has a type that specifically can't have fragments
    … so easy to do in spec

    Wendy Reid: is that the current test in the PR that you have out?

    Matt Garrish: yeah (I didn't know we had an issue out for this at the time)

    Proposed resolution: Merge PR 1670, close issue 1303 (Wendy Reid)

    Shinya Takami (高見真也): +1

    Toshiaki Koike: +1

    Masakazu Kitahara: +1

    Proposed resolution: Merge PR 1670, close issue 1303, forbidding fragment identifiers in hrefs for items (Wendy Reid)

    Dave Cramer: +1

    Matt Garrish: +1

    Ben Schroeter: +1

    Brady Duga: +1

    Matthew Chan: +1

    Wendy Reid: +1

    Fred Chasen: +1

    Shinya Takami (高見真也): +1

    Resolution #2: Merge PR 1670, close issue 1303, forbidding fragment identifiers in hrefs for items

  6. iherman commented on May 14, 2021

    @iherman
    Member

    @mattgarrish I did not close the issue until #1670 is open; we shouldn't forget to do it.

  7. removed
    Agenda+Issues that should be discussed during the next working group call.
    on May 14, 2021
  8. mattgarrish commented on May 14, 2021

    @mattgarrish
    Member

    I did not close the issue until #1670 is open; we shouldn't forget to do it.

    Right, and I have this issue linked from the PR so it should close automatically with it.

  9. added
    EPUB33Issues fixed in the EPUB 3.3 revision
    Spec-EPUB3The issue affects the core EPUB 3.X Recommendation
    on Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EPUB33Issues fixed in the EPUB 3.3 revisionSpec-EPUB3The issue affects the core EPUB 3.X Recommendation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions