E4H

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