Account Options

  1. Sign in
Google Groups Home
« Groups Home
Message from discussion Xhtml menu
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Richard Cornford  
View profile  
 More options Aug 4 2005, 4:23 am
Newsgroups: alt.html
From: "Richard Cornford" <Rich...@litotes.demon.co.uk>
Date: Thu, 4 Aug 2005 09:23:50 +0100
Local: Thurs, Aug 4 2005 4:23 am
Subject: Re: Xhtml menu

Neredbojias wrote:
> Toby Inkster wrote:
<snip>
>>> Depends on how you define DOM.  There's nothing any
>>> more wrong with using javascript to modify a page

>> No, there is nothing wrong with using Javascript to
>> modify a page. However, there is something very wrong
>> with using document.write to modify an XHTML page.
<snip>
> I think this whole thing is just an example of an
> invalid argument.

When scripting a web page you are scripting a document object model
created by the browser. If the document is an HTML document (including
tag soup) the browser will create an HTML DOM and when the document of
(real) XHTML the browser (assuming it can handle the document at all)
will create an XHTML DOM.

The two types of DOM are structurally similar but need handling in
different ways. HTML DOMs are case insensitive, disinterested in
namespaces, prefer direct setting of Element properties over the use of
the setAttribute method and provide numerous 'shortcut' properties. On
the other hand XHTML DOMs are case sensitive, require the use of
namespace qualified methods, prefer the use of setAttribute to property
assignment and tend not to provide 'shortcut' properties not explicitly
required by the W3C DOM specifications.

Very few non-trivial scripts are capable of operating with both HTML
DOMs and XHTML DOMs. One of the practical differences between the two
types of DOM is that in XHTML DOMs the document.write method is
unusable. It either fails silently (e.g. in Opera 7+) or they throw
exceptions (Mozilla). So it isn't really a question of whether
document.write is in some sense 'appropriate', but more a practical
consideration; it will not work in at least a significant proportion (if
not all) XHTML DOMs.

If mark-up is created as XHTML (preferably 1.0, Appendix C) and served
as text/html the browser (not unreasonably) assumes that the content
type is definitive and tag-soups the mark-up into an HTML DOM. The
result can happily be scripted as an HTML DOM (because it is), but that
script stands a really good chance of failing utterly in the event that
the same mark-up ever is interpreted as XHTML. And that is virtually
guaranteed to be true if the script uses document.write.

If the scripting of a document depends entirely on that document being
interpreted as an HTML document (and/or HTML tag soup), so that an HTML
DOM will be created to be scripted, many arguments for using mark-up
that resembles XHTML evaporate. For example, there is no 'future
proofing' in such mark-up because if the future ever allows the same
document to be served as XHTML its accompanying scripts would need to be
totally re-worked.

Richard.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.