Re: Making <template> play nice with XML and tags-and-text

On Wed, 18 Jul 2012, Adam Barth wrote:
>
> Inspired by a conversation with hsivonen in #whatwg, I spend some time 
> thinking about how we would design <template> for an XML world.  One 
> idea I had was to put the elements inside the template into a namespace 
> other than http://www.w3.org/1999/xhtml.

Interesting idea.

To handle multiple namespaces (specifically SVG and MathML), we could say 
that "inert" namespaces are namespaces that start with or end with a 
particular prefix, e.g. that are in the inert: scheme or that end with 
#inert. Then to de-inert nodes, you just strip the relevant part of the 
namespace string when cloning.

To make this work in HTML with nested namespaces might be interesting:

   <template>
     <div>
       <svg>
         <foreignObject>
           <math>
             <mi>
               <var>

I guess what we do in the HTML parser is have it use all the same 
codepaths as now, except the "create an element" operations check if 
there's a <template> on the stack, and if there is, then they add the 
inert marker to the namespace, but everything else in the parser acts as 
if the marker is not there?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 18 July 2012 17:43:46 UTC