Re: Simplifying element creation

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.

Sean

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