W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2012

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

From: Adam Barth <w3c@adambarth.com>
Date: Wed, 18 Jul 2012 10:47:34 -0700
Message-ID: <CAJE5ia-4nbw3XqTvRSFbDiCBnMquiOYN=53xsYfO8WdT5tNEHg@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: WebApps WG <public-webapps@w3.org>, Henri Sivonen <hsivonen@iki.fi>, Adam Klein <adamk@chromium.org>, Rafael Weinstein <rafaelw@chromium.org>
On Wed, Jul 18, 2012 at 10:43 AM, Ian Hickson <ian@hixie.ch> wrote:

> 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?
>

Yeah, that could work.  We also need to consider nested templates:

<template>
  <div>
    <template>
      <span>

I suspect we'll want the <span> to be in the same "inert" namespace as the
<div>, not doubly inerted.

Adam
Received on Wednesday, 18 July 2012 17:48:37 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:54 GMT