W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: [webcomponents] Template element parser changes => Proposal for adding DocumentFragment.innerHTML

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 11 May 2012 00:03:37 +0000 (UTC)
To: "Tab Atkins Jr." <jackalmage@gmail.com>
cc: Rafael Weinstein <rafaelw@google.com>, Webapps WG <public-webapps@w3.org>
Message-ID: <Pine.LNX.4.64.1205102358410.25792@ps20323.dreamhostps.com>
On Fri, 11 May 2012, Tab Atkins Jr. wrote:
> 
> For something like this:
> 
> $("<p>Example "+exnum+":</p><p><img src="+exsrc+">").appendTo(container);

Can we really not come up with anything better? It makes me really sad to 
think that the best we can do here is to go from a nice structured 
environment, concatenate our data together into a string, and then reparse 
the string back into structured data to add it to the DOM.

I understand that people do this kind of thing all the time, but I've 
always at least assumed that everyone agreed that it was a necessarily 
evil because the alternatives were even worse. I had hope when we were 
discussing Element.create() that maybe we were finally coming up with a 
workable alternative, but as far as I can tell that never went anywhere 
and now we're actually talking about adding APIs to _support_ string-based 
DOM tree generation as if it's an actually sane way of writing code.

Am I really the only one here who thinks this is horrifying?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 11 May 2012 00:04:01 GMT

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