[whatwg] createElement convenience method

Keryx Web wrote:
> var link_to_add  = document.createElement("a");
> var link_text    = document.createTextNode(the_text.nodeValue);
> link_to_add.appendChild(link_text);

Or you can write:

var link_to_add = document.createElement("a").appendChild(document.createTextNode("xyz"))

And if you find yourself doing this more than once or twice, you 
can always use a wrapper function.

-Michaeljohn

Received on Monday, 22 October 2007 17:03:52 UTC