Saturday, October 14, 2006

Semantic Ajax

Some school of thoughts argues that Ajax discourages the creation of websites using semantic XHTML design, and the separation of contents from presentation. They believe Ajax promotes creation of presentation with JavaScript, thus going against the idea of presentation being apart from content.

Although this allegation might be true, I don’t think it’s an inherit flaw in Ajax. It is more of how people are using it. The philosophy of Ajax does not necessary calls for content being muddled up with presentation, in fact with the proper use of CSS, Ajax application can be built with contents separated from presentation.

The technology that serves as the building blocks of Ajax clearly makes the creation of semantic Ajax application possible. This is because each building block is defined in its functions. And there is no reason why there should be overlapping of functions, if properly used.

I can divide the main components of any Ajax application into:
  • The Asynchronous Components
  • The Presentational Components
  • The Content Components

And if each component is handled by the appropriate technology, then I see no reason why any Ajax application can’t be as semantic as required.

For example the Asynchronous components will be handled by JavaScript and the XmlHttp object.
The Presentational components should be handled by your CSS.
and the Content Components should be handled by the DOM, JavaScript and your XHTML.

It is when these three components are not properly separated that Ajax might be an aberration to semantic XHTML. For example using JavaScript for Presentational Components will not be good practice. Since CSS can style dynamically generated contents, there is actually no reason for using JavaScript instead.

So it’s all with the developer and not Ajax as a technology. With semantic XHTML, accessibility, and the separation of content and presentation in mind, you can still build your web application the Ajax way!

No comments: