- From: Brendan Eich <brendan@secure.meer.net>
- Date: Sat, 09 Mar 2013 17:29:57 -0800
- To: Allen Wirfs-Brock <allen@wirfs-brock.com>
- CC: Ojan Vafai <ojan@chromium.org>, Adam Barth <w3c@adambarth.com>, Domenic Denicola <domenic@domenicdenicola.com>, Jonas Sicking <jonas@sicking.cc>, Anne van Kesteren <annevk@annevk.nl>, Rick Waldron <waldron.rick@gmail.com>, Adam Klein <adamk@chromium.org>, Ian Hickson <ian@hixie.ch>, "rafaelw@chromium.org" <rafaelw@chromium.org>, Alex Russell <slightlyoff@chromium.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>, "Mark S. Miller" <erights@google.com>
Allen Wirfs-Brock wrote: > On Mar 9, 2013, at 3:59 PM, Brendan Eich wrote: > >> Ojan Vafai wrote: >>> I would imagine that some folks on this list would be resistant to having the default handler be one that produces a DOM instead of a string. Could we have a browser-provided html handler that does E4H style parsing and not have a default handler at all? That way, the simplest code path for developers is to use the browser-provided handler and they have to go out of their way to do something else, but we still leave the door open for other use-cases/handlers (e.g. contextually parsed html). >>> >>> header.appendChild(`<h1>Welcome ${ firstName } ${ lastName }!</h1>`); // parse error >>> header.appendChild(html`<h1>Welcome ${ firstName } ${ lastName }!</h1>`); // E4H style parsing >>> header.appendChild(myspecialhtmlparser`<h1>Welcome ${ firstName } ${ lastName }!</h1>`); // template strings as currently proposed >>> >>> The only thing we lose here I think is an easy way to do multiline strings in JS. >> This is a productive suggestion. Thanks -- we will discuss it at next week's Ecma TC39 meeting, I've added it to the agenda. > > and a plausible name for the tag handler that only does simple string interpolation is: String > > In other words it is just an overload on the String constructor (assuming we make sure that callsite objects are recognizable) and you would use it like: > console.log(String`Welcome ${ firstName } ${ lastName }!`); No, the idea Ojan put forth is that the tag-less form should call a default handler other than String, in browsers. Specifically it would do a checked form of HTML parsing that threw if interpolations were not complete and well-formed subtrees. /be
Received on Sunday, 10 March 2013 01:30:24 UTC