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

"rel" attribute disallowed in "a" element inside "svg" element (epubcheck 4.2.2) #1172

Closed
GarthConboy opened this issue Aug 3, 2020 · 8 comments
Assignees
Labels
spec: EPUB 3.x Impacting the support of EPUB 3.x specifications status: completed Work completed, can be closed type: false-positive This issue is about valid content being incorrectly rejected
Milestone

Comments

@GarthConboy
Copy link
Contributor

GarthConboy commented Aug 3, 2020

The nesting in the title yields the following error:

      error {
        resource: "OEBPS/page_22.xhtml"
        line: 11
        column: 1431618
        description: "Error while parsing file: attribute \"rel\" not allowed here; expected attribute \"alignment-baseline\", \"aria-activedescendant\", \"aria-atomic\", \"aria-autocomplete\", \"aria-busy\", \"aria-checked\", \"aria-colcount\", \"aria-colindex\", \"aria-colspan\", \"aria-controls\", \"aria-current\", \"aria-describedby\", \"aria-details\", \"aria-disabled\", \"aria-dropeffect\", \"aria-errormessage\", \"aria-expanded\", \"aria-flowto\", \"aria-grabbed\", \"aria-haspopup\", \"aria-hidden\", \"aria-invalid\", \"aria-keyshortcuts\", \"aria-label\", \"aria-labelledby\", \"aria-level\", \"aria-live\", \"aria-modal\", \"aria-multiline\", \"aria-multiselectable\", \"aria-orientation\", \"aria-owns\", \"aria-placeholder\", \"aria-posinset\", \"aria-pressed\", \"aria-readonly\", \"aria-relevant\", \"aria-required\", \"aria-roledescription\", \"aria-rowcount\", \"aria-rowindex\", \"aria-rowspan\", \"aria-selected\", \"aria-setsize\", \"aria-sort\", \"aria-valuemax\", \"aria-valuemin\", \"aria-valuenow\", \"aria-valuetext\", \"baseline-shift\", \"class\", \"clip\", \"clip-path\", \"clip-rule\", \"color\", \"color-interpolation\", \"color-interpolation-filters\", \"color-profile\", \"color-rendering\", \"cursor\", \"direction\", \"display\", \"dominant-baseline\", \"enable-background\", \"externalResourcesRequired\", \"fill\", \"fill-opacity\", \"fill-rule\", \"filter\", \"flood-color\", \"flood-opacity\", \"focusable\", \"font-family\", \"font-size\", \"font-size-adjust\", \"font-stretch\", \"font-style\", \"font-variant\", \"font-weight\", \"glyph-orientation-horizontal\", \"glyph-orientation-vertical\", \"href\", \"id\", \"image-rendering\", \"kerning\", \"letter-spacing\", \"lighting-color\", \"marker-end\", \"marker-mid\", \"marker-start\", \"mask\", \"ns:type\", \"onactivate\", \"onclick\", \"onfocusin\", \"onfocusout\", \"onload\", \"onmousedown\", \"onmousemove\", \"onmouseout\", \"onmouseover\", \"onmouseup\", \"opacity\", \"overflow\", \"pointer-events\", \"requiredExtensions\", \"requiredFeatures\", \"role\", \"shape-rendering\", \"stop-color\", \"stop-opacity\", \"stroke\", \"stroke-dasharray\", \"stroke-dashoffset\", \"stroke-linecap\", \"stroke-linejoin\", \"stroke-miterlimit\", \"stroke-opacity\", \"stroke-width\", \"style\", \"systemLanguage\", \"tabindex\", \"text-anchor\", \"text-decoration\", \"text-rendering\", \"transform\", \"unicode-bidi\", \"visibility\", \"word-spacing\", \"writing-mode\", \"xlink:actuate\", \"xlink:arcrole\", \"xlink:role\", \"xlink:show\", \"xlink:title\", \"xlink:type\", \"xml:base\", \"xml:lang\" or \"xml:space\" (with xmlns:ns=\"http://www.idpf.org/2007/ops\") or an attribute from another namespace"
        message_id: "RSC-005"
      }

An extract of markup would be (ellipses indicate clipped markup):

<body id="68c60dac_body">
<div>
<svg width="100%" height="100%" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<g ...>
...
<a xlink:href="https://..." target="_blank" rel="noreferrer">
...
</g>
</svg>
</div>
</body>

I think this should be okay. Does the SVG schema need updating?

@mattgarrish
Copy link
Member

mattgarrish commented Aug 3, 2020

Yes, it's valid, but the schemas don't fully support svg2.

I've opened an issue against the nu validator to add: validator/validator#1008

@rdeltour rdeltour added spec: EPUB 3.x Impacting the support of EPUB 3.x specifications status: blocked Blocked by another issue or situation type: false-positive This issue is about valid content being incorrectly rejected labels Aug 4, 2020
@bduga
Copy link

bduga commented Aug 4, 2020

I am not an svg expert, but I am concerned that it will be difficult to validate svg in the era of living standards. An svg 1.1 validator should reject the example since rel wasn't allowed on a elements in that version. While it is now allowed in svg 2, an svg 2 validator should reject the example because the svg element has a version attribute which is no longer allowed. Are we using (or proposing) some sort of hybrid validator? I wonder if the correct answer is to not worry about svg validation, but that is a larger discussion.

@mattgarrish
Copy link
Member

mattgarrish commented Aug 4, 2020

Are we using ... some sort of hybrid validator?

That's what I understand is done for the nu validator based on this discussion I found.

For epubcheck, my understanding is that we want to be in sync with web validation generally, except where epub specifically diverges, so that you don't get mixed signals. That isn't entirely possible at this stage, since we only use the schemas and not the additional java checks, but I believe fuller integration might come in a later refactor of epubcheck.

No opinion here on whether or not to check svg, though. That would be a discussion for the main group to pick up.

@GarthConboy
Copy link
Contributor Author

GarthConboy commented Aug 4, 2020

Note that I updated the initial description of this bug to remove version="1.1" which was technically wrong for including "rel" inside an SVG nested "a" element. No change in behavior... except now the bug report is now completely correct (I think!).

@GarthConboy
Copy link
Contributor Author

GarthConboy commented Aug 4, 2020

Another example of a similar issue is this error:

ERROR(RSC-005): target.epub/OEBPS/page_22.xhtml(11,81921): Error while parsing file: attribute "fill" not allowed here; expected attribute "aria-activedescendant", "aria-atomic", "aria-autocomplete", "aria-busy", "aria-checked", "aria-colcount", "aria-colindex", "aria-colspan", "aria-controls", "aria-current", "aria-describedby", "aria-details", "aria-disabled", "aria-dropeffect", "aria-errormessage", "aria-expanded", "aria-flowto", "aria-grabbed", "aria-haspopup", "aria-hidden", "aria-invalid", "aria-keyshortcuts", "aria-label", "aria-labelledby", "aria-level", "aria-live", "aria-modal", "aria-multiline", "aria-multiselectable", "aria-orientation", "aria-owns", "aria-placeholder", "aria-posinset", "aria-pressed", "aria-readonly", "aria-relevant", "aria-required", "aria-roledescription", "aria-rowcount", "aria-rowindex", "aria-rowspan", "aria-selected", "aria-setsize", "aria-sort", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext", "class", "clip", "clip-rule", "color", "color-interpolation", "color-profile", "color-rendering", "cursor", "display", "externalResourcesRequired", "fill-opacity", "filter", "focusable", "height", "href", "id", "image-rendering", "mask", "ns:type", "onactivate", "onclick", "onfocusin", "onfocusout", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "opacity", "overflow", "pointer-events", "preserveAspectRatio", "requiredExtensions", "requiredFeatures", "role", "shape-rendering", "stroke-opacity", "style", "systemLanguage", "tabindex", "text-rendering", "transform", "vector-effect", "visibility", "width", "x", "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show", "xlink:title", "xlink:type", "xml:base", "xml:lang", "xml:space" or "y" (with xmlns:ns="http://www.idpf.org/2007/ops") or an attribute from another namespace

when presented with:

<body id="68c60dac_body">
<div>
<svg width="100%" height="100%" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<g ...>
...
<image clip-path="url(#g4d46da3d71_0_0.1)" fill="#000" width="719.0" height="483.0" x="0.0" y="0.0" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBO ... ">
...
</g>
</svg>
</div>
</body>

@murata2makoto
Copy link
Contributor

I think that SVG validation should not be lifted, since maintenance of EPUB assets containing invalid SVG fragments is likely to be annoying.

@mattgarrish
Copy link
Member

While I'm fine if the EPUB specs ultimately do not require validity for conformance, it would greatly reduce the usefulness of epubcheck if we stop checking the validity of SVG and XHTML files completely.

Perhaps we need to consider other options, like defining a separate message category for validity issues or only strictly validating if a flag is set.

@rdeltour rdeltour added this to the v5.0.0-beta-1 milestone Nov 13, 2021
@rdeltour rdeltour added newcomers friendly 😊 This issue can be picked up by newcomers to the project! status: ready for implem The issue is ready to be implemented and removed status: blocked Blocked by another issue or situation newcomers friendly 😊 This issue can be picked up by newcomers to the project! labels Nov 13, 2021
@rdeltour rdeltour added status: in progress The issue is being implemented by the development team and removed status: ready for implem The issue is ready to be implemented labels Jan 23, 2022
@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
@rdeltour
Copy link
Member

rdeltour commented Dec 8, 2022

SVG content model checks are now informative only since #1365.

@rdeltour rdeltour closed this as completed Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec: EPUB 3.x Impacting the support of EPUB 3.x specifications status: completed Work completed, can be closed type: false-positive This issue is about valid content being incorrectly rejected
Projects
None yet
Development

No branches or pull requests

5 participants