W3C home > Mailing lists > Public > spec-prod@w3.org > January to March 2012

Fall mechanisms (Re: [Pubrules] Changes to enable use of HTML5)

From: Philippe Le Hegaret <plh@w3.org>
Date: Wed, 14 Mar 2012 10:02:11 -0400
To: Cameron McCormack <cam@mcc.id.au>
Cc: spec-prod <spec-prod@w3.org>
Message-ID: <1331733731.6050.466.camel@chacal>
On Wed, 2012-03-14 at 11:37 +1100, Cameron McCormack wrote:
> Do you have a concrete suggestion on how to implement this fallback?  I 
> cannot think right now of a way to do this without script, for example:
> 
>    <!DOCTYPE html>
>    <style>
>      body.no-inline-svg svg,
>      .svg-fallback { display: none }
>      body.no-inline-svg .svg-fallback { display: initial }
>    </style>
>    <body>
>    <svg></svg>
>    <script>
>      var e = document.getElementsByTagName("svg")[0];
>      if (e.namespaceURI != "http://www.w3.org/2000/svg") {
>        document.body.className = "no-inline-svg";
>      }
>      e.parentNode.removeChild(svg);
>    </script>
>    <p>Consider the following diagram:</p>
>    <svg>
>      <path d="..."/>
>    </svg>
>    <img class=svg-fallback src=diagram.png>

That would work for me at least. It guarantees that you'll see something
independently of whether scripting is enabled or not.

Philippe
Received on Wednesday, 14 March 2012 14:02:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 14 March 2012 14:02:26 GMT