AJAX-Tips
DOM is a very important part of most online Ajax based applications. In summary, DOM has the ability to control the HTML and XML behaviors in a website. Through nodes, developers would have the ability to transmit different types of information to the client side faster.
Before we present the tips on DOM, let us go back a little bit at two popular functions related to Ajax development: the insertBefore and appendChild. These commands are made to control the nodes and childNodes which are additional information that could be transmitted. The commands will enable the function to grab the information before they are executed.
However, what if you have an application that works like a server push of Ajax but still need a command from the user? That is where the trick comes in. The commands, insertAfter and prependChild could be used. As the name suggests, insertAfter brings with it the nodes while the prependChild establishes the connection of the Childnodes by placing it at the beginning of the function. There seems to be a mix up with this since insertAfter extracts the information in the later part of the application. The command actually prepared insertAfter so that the nodes will be later recognized.
What makes this command good in an Ajax based application is the fact that the nodes do not have to come from a single source. This enables the developers to build a highly efficient application with a very extensive data. The childnodes even provides almost unlimited streams of data for the user.
The problem however is not necessarily on the functions themselves. Properly coded, these functions will work like magic in an Ajax based website. The problem however is based on the DOM itself. Although it promises efficiency and speed in the application, it sacrifices the user’s ability to multitask by requiring a considerable amount of memory. That is why it is often recommended that this function should be applied to online applications that are lightweight or else DOM will be the cause of the slowdown of the online application.
If the need for a heavy web application cannot be disregarded, one of the possible work-around for DOM is to use HTML more and more. That could jeopardize the beauty of the website but think again of the DOM feature: it was created to control not only XML but HTML as well. So you are just adding more HTML features in the application but instead of letting the website become heavier in the process. You will end up with an intensive website but instead of using up the memory, you have focused DOM on its original function – all because they have used a lighter HTML.
insertAfter and prependChild commands may not be a popular function in DOM, but these functions provides additional options for developers to manipulate nodes in their online application. DOM should be able to handle these additional commands without adding memory requirements. By effectively using HTML, DOM becomes an ally for controlling the required memory so that the application could run as expected.