foreignObject and viewBox and XHTML

  What is the theory here? Is this something that should work
  but doesn't (not in Gecko or Webkit) or is it something that
  definitely shouldn't work?

--
Jason Dusek




<?xml version="1.0" encoding="UTF-8" ?>

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="full"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  preserveAspectRatio="none"
 >


  <rect width="100%" height="100%" fill="black" />

  <title> Embedding XHTML </title>

  <!-- This text is visible.
    -->
  <foreignObject x="0" y="0" width="200" height="200">
    <body xmlns="http://www.w3.org/1999/xhtml">
      <p> Text in root SVG element. </p>
    </body>
  </foreignObject>


  <!-- This SVG element has a viewBox defined. None of the text shows up.
    -->
  <svg viewBox="-1.6180339887498948482 -1 3.23606797749979 2" >
    <!--  Bounding box to see the viewBox.
      -->
    <rect x="-50%" y="-50%" width="100%" height="100%"
      stroke-width="0.002" stroke="white" fill="none"
     />

    <foreignObject x="0" y="0" width="2" height="2">
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p> Text scaled and fit into inner SVG element with a
            <code>viewBox</code>.
        </p>
      </body>
    </foreignObject>

    <foreignObject x="0" y="0" width="200" height="200">
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p> Text unscaled and fit into inner SVG element with a
            <code>viewBox</code>.
        </p>
      </body>
    </foreignObject>

  </svg>


  <!-- This SVG element has no viewBox defined and the text is visible.
    -->
  <svg>

    <foreignObject x="0" y="0" width="200" height="200">
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p> Text fit into inner SVG element with no <code>viewBox</code>.
        </p>
      </body>
    </foreignObject>

  </svg>


</svg>

Received on Wednesday, 5 August 2009 11:43:42 UTC