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

Scripted SVG #2098

Closed
mattgarrish opened this issue Mar 18, 2022 · 1 comment · Fixed by #2136
Closed

Scripted SVG #2098

mattgarrish opened this issue Mar 18, 2022 · 1 comment · Fixed by #2136
Labels
EPUB33 Issues addressed in the EPUB 3.3 revision Spec-EPUB3 The issue affects the core EPUB 3.3 Recommendation Topic-ContentDocs The issue affects EPUB content documents

Comments

@mattgarrish
Copy link
Member

I was just asked a question about embedding scripted svg and couldn't decipher exactly what is valid from the specification.

It's clear that you can have a scripted Top-Level SVG Content Document. And we say that an SVG with script referenced from an HTML iframe element is container-constrained.

But what happens in other cases? Can you embed an SVG with scripting using object or is that invalid? Can you embed an SVG with scripting in img even though the scripting won't work, or should that be reported as invalid?

@mattgarrish mattgarrish added the Topic-ContentDocs The issue affects EPUB content documents label Mar 18, 2022
@wareid wareid added the Agenda+ Issues that should be discussed during the next working group call. label Mar 23, 2022
@iherman
Copy link
Member

iherman commented Mar 25, 2022

The issue was discussed in a meeting on 2022-03-25

List of resolutions:

  • Resolution No. 2: Add note about container constraints to scripting section, close issue 2098.
View the transcript

2. Scripted SVG (issue epub-specs#2098)

See github issue epub-specs#2098.

Dave Cramer: we can have scripted Top Level Content document, and scripted svg in iframe is container-constrained, but what about other cases?.

Matt Garrish: so is scripted svg valid? And what about RS support for scripting? Are we saying you can put scripted SVG anywhere, but it might not be supported?.

Dave Cramer: has anyone here ever put scripted SVG into an epub?.

Brady Duga: it's a weird question, because its scripting, so it's already not guaranteed to work.
… the real question is do we explicitly make it illegal in some cases.
… i'm not sure why we would need to because there are already no guarantees when it comes to scripting, seems like an edge case we don't need to spend that much time on.

Dave Cramer: i presume there have not been epubcheck bugs specifically about this?.

Matt Garrish: no, it's valid, so we don't say you can't do it. But this doesn't fall into container-constrained.

Ivan Herman: we should say yes it's allowed, and we should write some tests for it.
… i've already done some tests of svg, and i've tried putting svg in iframe.
… if testing reveals lack of support, then we will deal with that.
… but I wouldn't make it invalid.
… i think there is a big difference in HTML whether you use svg as object or in img tag.
… not sure if scripted svg will work in img tag even in HTML.

Matt Garrish: no, scripting won't work in img tag.
… just strange to say that the container-constrained ones must be done in iframe (not object).
… any reason why we can't add object to container-constrained?.
… what is container-constrained stopping?.

Brady Duga: i think container-constrained was meant to make is to that the element wouldn't change its size, that it wouldn't interact with the DOM, or break anything else.
… but you don't really get that with object.

Ivan Herman: so, as of right now, using object is illegal?.

Brady Duga: it's fine, it just doesn't count as container-constrained.
… it means that the content document would be scripted, instead of scripting being limited to the element.

Matt Garrish: we say you should support container-constrained scripting, but may support scripting in the content document.

Dave Cramer: i found the part of HTML spec that says you can't have scripted svg in img.
… (it also says support for svg is not required for HTML spec).

Ivan Herman: okay, so what's the resolution?.

Dave Cramer: we wait to see what tests tell us?.

Ivan Herman: if we are responding to a specific question (as it says in issue) then we should make an editorial comment.

Matt Garrish: we can mention that object does not count as container constrained.

Brady Duga: it sounds like a good idea to add clarifying text, but is there something in our spec that makes people believe that putting something in an object tag would make something container-constrained?.

Matt Garrish: content document is silent on whether or not it is valid to put scripted svg in object, you'd need to go to RS spec to see that.

Brady Duga: i'm fine with making people who want to use scripting in epub read RS spec.

Ivan Herman: my position is that a real question came up, so that means the core spec isn't clear enough. We should do something about that..
… let's not make a big deal about it.

Zheng Xu (徐征): what does the RS need to do beyond a normal web browser?.
… regarding scripted svg.

Dave Cramer: i don't think there's anything.
… our basic idea is to make it easier for RS, to think of ways to allow some scripting that doesn't blow up the entire layout of the book.

Ivan Herman: only minor thing is that an svg file should have access to the epubreadingsystem object.

Zheng Xu (徐征): in terms of bad usage of svg scripting, I don't know how to avoid this.

Ivan Herman: as soon as we allow scripting, we can no longer prevent users from shooting themselves in the foot with it.

Proposed resolution: Add note about container constraints to scripting section, close issue 2098. (Wendy Reid)

Dave Cramer: +1.

Ivan Herman: +1.

Tzviya Siegman: +1.

Matthew Chan: +1.

Rick Johnson: +1.

Charles LaPierre: +1.

Matt Garrish: +1.

Wendy Reid: +1.

Ben Schroeter: +1.

Masakazu Kitahara: +1.

Bill Kasdorf: +1.

Laura Brady: +1.

Brady Duga: 0.

Zheng Xu (徐征): 0.

Resolution #2: Add note about container constraints to scripting section, close issue 2098.

@iherman iherman removed the Agenda+ Issues that should be discussed during the next working group call. label Mar 28, 2022
@mattgarrish mattgarrish added the EPUB33 Issues addressed in the EPUB 3.3 revision label Mar 31, 2022
@mattgarrish mattgarrish added the Spec-EPUB3 The issue affects the core EPUB 3.3 Recommendation label Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EPUB33 Issues addressed in the EPUB 3.3 revision Spec-EPUB3 The issue affects the core EPUB 3.3 Recommendation Topic-ContentDocs The issue affects EPUB content documents
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants