- From: David Dorward <david@dorward.me.uk>
- Date: Sat, 29 Jul 2006 14:42:50 +0100
- To: www-html@w3.org
On Sat, Jul 29, 2006 at 02:21:31PM +0100, Mark Birbeck wrote: > The issue *is* an XML one. > > document.write() is normally carried out as the document is loading, > by interspercing <script> elements within the normal mark-up. This > means that the *initial* document at the point of completion of the > 'onload' event could be different when running in a browser with > script, and one without. > > But with XML we really need to have the document fully loaded and > parsed before we can start manipulating it, which means that > document.write() doesn't mean anything. There is nothing stopping (for instance) a user agent parsing the XML, executing document.write() statements in it to get a new XML document, and then parsing that new document. It isn't convenient, but it isn't forbidden by any spec. So XML doesn't prevent document.write, it just makes it more complicated for tool authors to handle. > So if XHTML doesn't have document.write(), then that means that > whatever mark-up you put into the body of your document you can > guarantee it will be the same after the 'onload' event regardless of > whether the browser has script turned on or off, or doesn't even > support script. > > Of course, once the document has finished loading, further changes to > the DOM could be made using script, but the key point is that by this > time the 'base' or 'core' document has already been finalised, so were > script to be disabled or not supported, then this document would in > effect be the <noscript> option. Not really. You would have to write the script do it explicitly deleted the default content if scripting was enabled (and the content might show up while the document is loading but before the script executes). -- David Dorward http://dorward.me.uk
Received on Saturday, 29 July 2006 13:42:56 UTC