You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
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:
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...
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.
👍 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...)
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.
Activity
iherman commentedon Jun 10, 2022
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 mother of all knowledge, a.k.a. Wikipedia, uses the term of Web Resource which says:
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...
mattgarrish commentedon Jun 10, 2022
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.
iherman commentedon Jun 10, 2022
👍 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...)
mattgarrish commentedon Jun 10, 2022
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.