W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2011

Re: Simplifying element creation

From: Sean Hogan <shogun70@westnet.com.au>
Date: Fri, 07 Oct 2011 07:51:43 +1100
Message-ID: <4E8E14DF.9020707@westnet.com.au>
To: Julien Richard-Foy <jrf@zenexity.com>
CC: DOM public list <www-dom@w3.org>
On 7/10/11 1:20 AM, Julien Richard-Foy wrote:
>> 3. How is generating a JS structure then calling Element.create(),
>> node.append(), etc a win compared to generating a string of HTML then
>> calling innerHTML, insertAdjacentHTML()?
> It may be better for performance concerns, but itís surely less error
> prone. When appending strings you have to be careful to close tags at
> the right place, to escape quotes, etc.
> Using strings is far less composable than using a proper tree API.

Either way, you write a function, test it, then you're done.
Or, more likely, you use a function that someone else has already 
written and is already in production.

Received on Thursday, 6 October 2011 20:52:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:36:59 UTC