Re: E4H

Also, remember that if HTML was a valid literal value in JS we need to
be careful with cross origin script tags.

<script src="http://www.example.com/private-data.html"></script>

I don't think it would be an issue because the literal is just thrown
away so there is no reference to it but w need to tread lightly here.

erik








On Tue, Oct 25, 2011 at 11:07, Alex Russell <slightlyoff@google.com> wrote:
> On Tue, Oct 25, 2011 at 2:07 AM, Anne van Kesteren <annevk@opera.com> wrote:
>> So I think what is needed to make the DOM drastically easier to use is an
>> extension to ECMAScript specific to implementations of the Window-object
>> where the literals translate automatically to DOM objects.
>
> I'm unsure that this solves more than the one-time-templating problem
> which, as I noted earlier, isn't a problem I think we should even be
> solving.
>
>> This extension is
>> ideally simpler than E4X and does not have to support all of the DOM.
>> Basically elements, attributes, and descendant text nodes are what is
>> important here I think.
>>
>> E.g. to create a hyperlink and append it to a document all you would have to
>> do is:
>>
>>  var link = <a href="http://example.org/">Example Organization</a>
>>  document.body.appendChild(link)
>>
>> For comparison:
>>
>>  var link = document.createElement("a")
>>  link.setAttribute("href", "http://example.org/")
>>  link.appendChild(document.createTextNode("Example Organization"))
>>  document.body.appendChild(link)
>>
>> It only gets worse if you have more descendants or attributes.
>
> Quasis get us out of most of this.
>
>

Received on Tuesday, 25 October 2011 19:42:27 UTC