interesting point, don't agree with the conclusion

Hixie's Natural Log: Why document.write() doesn't work in XML. Essentially the conclusion seems to be that you can't use document.write() at all; whereas I read this as "bad code is still bad in XHTML". In the quoted example, the opening tag is delivered by the script, while the closing tag is embedded in the main document. This is a stupid thing to do since it creates an obvious point of failure. If you write in the opening tag, you should use the same method to write in the accompanying closing tag. That way if the script fails, neither tag is inserted and all should be well in a decently-formed document.

The major point still stands though: most validation does not include the output of scripts, so the output of a document.write() can easily invalidate an otherwise valid document.

The fault, dear reader, remains at the feet of the developer; with some annoyance added by the UA which only reads part of the document.


Add Your Comments

Please use Name/URL or an OpenID option rather than posting anonymously.

Post a Comment