- From: Jim Ley <jim@jibbering.com>
- Date: Sat, 29 Jul 2006 15:02:12 +0100
- To: www-html@w3.org
"Mark Birbeck" <mark.birbeck@x-port.net> wrote in message
news:640dd5060607290621j6d2e9adan27621801efd18e7c@mail.gmail.com...
> 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.
Which is no problem, and applies as much to an HTML document as an XML one.
> 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.
I don't see why we need that, indeed requiring it would prevent all sorts of
things that are required on the web today - progressive rendering for
example - a requirement in SVG for example.
> 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.
No you don't, there is no such safety in XHTML today:
As an example, the following is not disallowed:
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<script type="text/javascript">
var el=document.createElementNS('http://www.w3.org/1999/xhtml','title');
el.appendChild(document.createTextNode('chickens'));
document.documentElement.firstChild.appendChild(el)
</script>
</head>
<body>
Testing...
</body>
</html>
Indeed, it works in current XHTML user agents.
That doesn't change the fact that xhtml2 really doesn't need a noscript - it
was a mistake in previous versions.
Cheers,
Jim.
Received on Saturday, 29 July 2006 14:03:10 UTC