RE: template namespace attribute proposal

I would also prefer to enable this to work without any extra annotation. So much of the rest of how SVG/MathML are handled in HTML is seamless by design.

From: adamk@google.com [mailto:adamk@google.com] On Behalf Of Adam Klein
Sent: Thursday, March 12, 2015 11:17 AM
To: Benjamin Lesh
Cc: WebApps WG
Subject: Re: template namespace attribute proposal

On Wed, Mar 11, 2015 at 8:32 PM, Benjamin Lesh <blesh@netflix.com<mailto:blesh@netflix.com>> wrote:
I'd like to propose that the <template> tag have a namespace="" attribute that allows the user to specify namespaces such as "http://www.w3.org/2000/svg", so that the document fragment that comes from `.content` is created properly.

e.g.:

<template id="my-svg-template" namespace="http://www.w3.org/2000/svg>
  <circle cx="10" cy="10" cr="10"/>
</template>

For clarity, is this significantly different from the below (which works today)?

<template id="tmpl">
  <svg>
    <circle .../>
  </svg>
</template>

Clearly there's an extra step here, in that accessing the SVG elements requires hopping into firstElementChild, but adding new namespace-related features seems unfortunate.

- Adam

Received on Thursday, 12 March 2015 18:25:53 UTC