mxp1988 / epubcheck

Automatically exported from code.google.com/p/epubcheck
MIT License
0 stars 0 forks source link

HTML body elements inside svg:foreignObject should not generate an error #222

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
PROBLEM:

In order for Adobe Digital Editions to render nested HTML content (HTML inside 
SVG inside HTML), you *must* put an HTML <body> element inside the 
<foreignObject> element.  If you do not include the <body> element, ADE does 
not render the nested HTML, and you end up with an empty page.

The validator pukes on the <body> tag here.  Arguably, this ADE behavior is 
incorrect in the context of SVG nested in HTML—from a purely browser-centric 
view, a <body> tag that is effectively inside another <body> tag makes little 
sense—but it looks legal by my reading of the spec, unless I missed 
something.  Either way, the extra <body> tag is basically harmless, is ignored 
by other UAs/readers, and fixes a very serious real-world problem.  The <body> 
tag should be allowed in that context unless there's a very good reason not to 
allow it.

And when the SVG is in a separate file, it still fails validation in the same 
way, even though the <body> tag is ostensibly required in that usage (because 
it isn't inside an HTML <body> element at that point).

What steps will reproduce the problem?

<?xml version="1.0" encoding="utf-8"?>
<!-- version="-//W3C//DTD XHTML 1.1//EN" -->
<html version="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:svg="http://www.w3.org/2000/svg">
<head>
<title>Part page</title>
<link rel="stylesheet" type="text/css" href="nookstyles.css" />
<link rel="stylesheet" type="text/css" href="nookstyles2.css" />
</head>
<body>
<div class="partpage">
<svg:svg version="1.1" width="6in" height="9in" baseProfile="tiny" viewBox="0 0 
4320 6480" preserveAspectRatio="xMidYMid">
  <svg:g transform="scale(10)">
      <svg:g fill="none" stroke="green" stroke-width="1"><svg:line x1="0" y1="0" x2="431" y2="0" /><svg:line x1="431" y1="0" x2="431" y2="647" /><svg:line x1="431" y1="647" x2="0" y2="647" /><svg:line x1="0" y1="647" x2="0" y2="0" /></svg:g>
      <svg:foreignObject x="0" y="148" width="432" height="300" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
          <body>
            <div class="pp_partnum" xmlns="http://www.w3.org/1999/xhtml">Part I:</div>
          </body>
        </svg:foreignObject>
  </svg:g>
</svg:svg>
</div> 
</body> 
</html>

RESULT:

Validator produces errors.

EXPECTED:

Validator should not produce errors.

PLATFORM:

3.0-RC-1
OS X 10.8.2

Original issue reported on code.google.com by dgatwoo...@gmail.com on 22 Nov 2012 at 7:32

GoogleCodeExporter commented 8 years ago

Original comment by markus.g...@gmail.com on 25 Nov 2012 at 9:32

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r378.

Original comment by markus.g...@gmail.com on 25 Nov 2012 at 11:16