W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2011

E4H

From: Anne van Kesteren <annevk@opera.com>
Date: Tue, 25 Oct 2011 18:07:48 +0900
To: public-script-coord@w3.org
Message-ID: <op.v3wgzalh64w2qv@annevk-macbookpro.local>
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. 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.


-- 
Anne van Kesteren
http://annevankesteren.nl/
Received on Tuesday, 25 October 2011 09:08:32 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC