Re: Inline SVG: Embedded vs. Metadata Content Distinction (Was: Fwd: [whatwg] Allow Select SVG Elements In <head>)

On Sat, Aug 29, 2015 at 12:51 AM, Hugh Guiney <hugh.guiney@gmail.com> wrote:
> Bueller...? Bueller...?
>
> This request is almost 5 years old now, but it is even more relevant today,
> now that web developers are increasingly embracing SVG for purposes of
> responsive design and accommodating HiDPI displays.
>
> Putting SVG <defs> and other metadata-related elements in HTML's <head>
> seems like an obvious choice from a semantic standpoint. But it is currently
> illegal in the HTML spec because SVG does not distinguish between embedded
> and metadata content models for its elements, which Hixie has requested so
> that the HTML spec can simply point to the SVG spec's definitions. (Please
> see quoted text.)
>
> Again, is this something the SVG WG is willing to do?

This isn't even something for the SVGWG to decide; it's simply
impossible to add new elements to HTML's <head>.  <head> autocloses
when it sees any element that's not <title>, <meta>, <link>, <script>,
or <style>, and people depend on this behavior - there's definitely
pages out there where an <svg> element is the first content and needs
to be displayed.

Just put a <defs>-only <svg> in the <body>.  Its location doesn't
actually matter, it's fine.

~TJ

Received on Saturday, 29 August 2015 05:58:50 UTC