tags:

views:

264

answers:

5

First of all, am I the only person using JSONML? And second of all, would you recommend using JSONML for inserting dynamic HTML or is InnerHTML more efficient?

A: 

I can't see how you can beat setting innerHTML for speedy updates. what would "using JSONML for inserting dynamic HTML" entail ?

Scott Evernden
A: 

For "inserting dynamic HTML" you want to use innerHTML of the DOM node. JSONML appears to be unrelated to this task, and looks like a data interchange format.

olore
except if it's a markup language...ohhh, it is. JSON = dataJSONML = JSON Markup Language.
Bogdan
+1  A: 

Bare in mind that (in IE) not every innerHTML is writable (innerHTML isn't standar compilant anyway). So closer you come to appending nodes rather then inserting html, better you are. As far as I can see, jsonml thingie creates DOM elements whch is nice. I can only sugest you to make some huge dataset, insert it in two different ways and mesure performance yourself.

Slartibartfast
A: 

JsonML and the connected libraries (templating, etc.) seem to offer an efficient way of generating dynamic HTML on the client side.

When I say efficient I mean, I mean that the programmer does not waste time or effort while completing his task. But I am not sure if you meant to ask whether using innerHTML is faster and requires less resources on the client side.

f3lix
A: 

While superficially used to perform similar tasks, JsonML and innerHTML are quite different beasts.

innerHTML requires you to have all the markup exactly as you want it ready to go, meaning that either the server is rendering the markup, or you are performing expensive string concatenations in JavaScript.

JsonML opens the door to client-side templating through JBST which means that your template is converted from HTML markup into a JavaScript template at build time. At runtime, you simply supply the data and you end up with DOM elements to be inserted or to replace an existing element (something innerHTML cannot easily do without extra DOM creation). Rebinding only requires requesting additional data, not the entire re-rendered markup. This is where large performance gains can be made as the markup can be requested/cached separately from the data.

For simplicity, innerHTML has been the preferred method for the HTML-Message pattern style of Ajax. But tool-sets like JsonFx can make using JsonML and JBST just as easy while delivering a full browser-side templating Ajax pattern.

McKAMEY