Re: html template string handler WAS: E4H and constructing DOMs

On Mar 11, 2013, at 11:01 AM, Ojan Vafai wrote:

> On Mon, Mar 11, 2013 at 10:22 AM, Adam Barth <w3c@adambarth.com> wrote:
> Is there a definition of the html quasis handler somewhere that I can study?
> 
> I don't believe there is. I think that's a whole separate discussion really. Changing the subject line to match. I'm not really sure what spec this would go in either. Perhaps it's own.
> 
> I see two options:
> 1. Do E4H style parsing. (http://www.hixie.ch/specs/e4h/strawman)
> 2. Do <template> style parsing through the regular HTML parser.
> 
> Both of these deal with the important case of creating a DOM that doesn't have an appropriate context element at the root. Specifically, html`<td>foo</td>` will work for both.
> 
> A difficult case is how you parse html`<a>foo</a>` because, without context, you don't know if that element is an HTML element or an SVG element. In either case, we'd need to add special syntax like the E4H syntax for this.

Note that the tag position is itself a subexpression so it can be a higher level function call that accepts parameters that could provide contextual information and returns the appropriate template handler:

    html({domain:SVG"})`<a>foo</a>`


Allen

Received on Monday, 11 March 2013 18:22:08 UTC