|
Posted by Andy Dingley on 02/18/06 15:54
On Sat, 18 Feb 2006 11:38:06 +0000, Dylan Parry <usenet@dylanparry.com>
wrote:
>> Ye. It looks to me like just plain old javascript doing some stuff to an
>> innerHTML.
>
>How else would you update the page with the new results? Google et al
>use nothing different in their own AJAX apps.
The honourable cephalod is quite right. ".innerHTML" has no part in
well-written AJAX work. It's flakey, it's slow and it's going to get
even more so as we drag slowly towards XML processing on the client
side.
AJAX is (or should) be about manipulation of the client browser's DOM,
i.e. the Object Model of the page, as it's in use by the browser and
long fter it has been rendered from the HTML document. Although it's
admittedly easy to work with innerHTML and insert some HTML fragments
into it that way, these need to be parsed by the browser before being
inserted into the DOM. If your AJAX is building long navigation browse
lists on th efly, then this speed difference can be appreciable.
For XML documents it's even worse, as innerHTML may force the browser to
flip from an XML DOM into a HTML representation (it might swap back
again later, if possible). Using innerHTML is _really_ incompatible
with trying to work in an XML style.
>> I thought that AJAX was something different to that.
There's no hard and fast spec for AJAX, so its hard to say just what is
and what isn't. But using .innerHTML is shoddy coding and I certainly
don't permit it for new work.
The difference between AJAX and the asynchronous JavaScript and
XMLHTTPRequest work that was going on back in '99 is that AJAX
represents a set of well thought out good practice for how to build
apps. .innerHTML is one of the possibilities that was rejected through
this tidying up process.
[Back to original message]
|