- From: Alex Russell <slightlyoff@google.com>
- Date: Tue, 25 Oct 2011 11:07:28 -0700
- To: Anne van Kesteren <annevk@opera.com>
- Cc: public-script-coord@w3.org
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 18:08:36 UTC