- From: Olli Pettay <Olli.Pettay@helsinki.fi>
- Date: Tue, 25 Oct 2011 15:31:57 +0300
- To: Anne van Kesteren <annevk@opera.com>
- CC: public-script-coord@w3.org
On 10/25/2011 12:07 PM, Anne van Kesteren 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. > 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) insertAdjacentHTML would work fine in this case. And we could add appendHTML or some such. We need plenty of use cases and write down requirements before adding anything like E4H to the web platform. I'm not against something like E4H, but before implementing or specifying anything like it, it is better to understand what kinds of problems we're trying to solve. -Olli > > It only gets worse if you have more descendants or attributes. > >
Received on Tuesday, 25 October 2011 12:33:31 UTC