Skip to content

Script data blocks and foreign resources #2331

Closed

Description

@mattgarrish

If we allow data files to travel in the epub container for use by scripts without having to meet CMT requirements, shouldn't we also allow foreign data in script tags?

It's not completely clear to me if it's allowed, as it depends on how you interpret "embedding" here:

it is not embedded directly in EPUB content documents (e.g., via [html] embedded content and [svg] image and foreignObject elements).

Since it's not a definitive list of cases, and the data is embedded in a content document when in script tags, that seems to make it illegal. But it doesn't make a lot of sense to allow in external files but not in script tags.

Activity

  1. iherman commented on Jun 10, 2022

    @iherman
    Member

    I agree it is unclear. And I also agree that we should allow the usage of data in script tags. However, I also wonder whether data in a script element could be considered as a "resource" in the first place.

    So what is a resource? If I take the WebArch document it starts with:

    The World Wide Web (WWW, or simply Web) is an information space in which the items of interest, referred to as resources, are identified by global identifiers called Uniform Resource Identifiers (URI).

    The mother of all knowledge, a.k.a. Wikipedia, uses the term of Web Resource which says:

    A web resource is any identifiable resource (digital, physical, or abstract) present on or connected to the World Wide Web.[1][2][3] Resources are identified using Uniform Resource Identifiers.[1][4]

    If I take these as basis, I could say that data within a script element is not a resource; it is not more of a resource than, say, the RDFa attributes within the HTML file. Which means that the discussion on exempt resources is irrelevant and, of course, it is fine to have them in EPUB...

  2. mattgarrish commented on Jun 10, 2022

    @mattgarrish
    MemberAuthor

    I have an even more simplistic take on it, which is that by definition the script element "does not represent content for the user."

    It's not embedding for direct rendering. That's fundamentally what our data file exemption is for. A script may process the data, but absent that it also won't appear in its raw form in an epub publication.

    Whether it's a "resource" is maybe blurred a bit because inline scripts (not data blocks) are executed even though they don't have separate URLs. Sort of like inlining CSS. They are separate formats from HTML, but without processing support they're also invisible to the user.

  3. iherman commented on Jun 10, 2022

    @iherman
    Member

    👍 to what you say. The only question is whether this is something we have to spell out in the spec. Or do we trust nobody will ask this question in the first place?

    (As we know, the whole fallback area might end up becoming under-implemented anyway...)

  4. mattgarrish commented on Jun 10, 2022

    @mattgarrish
    MemberAuthor

    Or do we trust nobody will ask this question in the first place?

    I think it's better to be clear in this case. Because you have to specify a media type for the data block, it's only a matter of time until someone gets confused by it.

    Epubcheck already does the right thing, despite it not being clear in the spec, so if you go by validation alone you'll never know anything is amiss.

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