Essentials of Javascript - Cultural View
Essentials of Javascript - Cultural View
Essentials of Javascript - Cultural View
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
JsonML 109<br />
}}<br />
"modified": "2006-12-31T23:59"<br />
Comparison To Similar Technologies<br />
XML/XSLT<br />
XSLT and XML can produce client-side templating as well, and both allow caching <strong>of</strong> the template separate from<br />
the data. For many, however, the syntax <strong>of</strong> JBST [2] is much easier to manage, due to its familiarity. JBST uses<br />
JavaScript natively in the template rather than requiring a mixing <strong>of</strong> a different type <strong>of</strong> control language.<br />
innerHTML<br />
While seemingly used to perform similar tasks, JsonML and innerHTML are quite different.<br />
innerHTML requires you to have all the markup exactly as you want it ready to go, meaning that either the server is<br />
rendering the markup, or you are performing expensive string concatenations in JavaScript.<br />
JsonML uses client-side templating through JBST, which means that HTML is converted into a JavaScript template<br />
at build time. At runtime, the data is supplied and DOM elements are the result. The resulting DOM elements can be<br />
inserted or replace an existing element—something innerHTML cannot easily do without creating excess DOM<br />
elements. Rebinding only requires requesting additional data, which is smaller than fully-expanded markup. As a<br />
result, large performance gains are <strong>of</strong>ten made, since the markup is requested (or cached) separately from the data.<br />
HTML Message Pattern / Browser-Side Templating<br />
For simplicity, innerHTML has been the preferred method for the HTML-Message pattern [5] style <strong>of</strong> Ajax. However,<br />
tools like JsonFx [6] aim to simplify JsonML and JBST implementation while still providing a full browser-side<br />
templating Ajax pattern. [7]<br />
External links<br />
• JsonML.org [8]<br />
• IBM developerWorks Article [9]<br />
• Java JSONML implementation [10] - written by Douglas Crockford<br />
• JsonFx.NET [11] - C#/.NET JBST Framework<br />
References<br />
[1] http://jsonml.org/Ajax-UI/Binding/<br />
[2] http://jsonml.org/bst<br />
[3] http://jsonml.org/BST/Example<br />
[4] http://tech.groups.yahoo.com/group/json/message/1115<br />
[5] http://ajaxpatterns.org/HTML_Message<br />
[6] http://jsonfx.net<br />
[7] http://ajaxpatterns.org/Browser-Side_Templating<br />
[8] http://jsonml.org<br />
[9] http://www.ibm.com/developerworks/library/x-jsonml/<br />
[10] http://json.org/javadoc/org/json/JSONML.html<br />
[11] http://jsonfx.googlecode.com