Re: Anyone else noticed this issue?
- From: Henry <rcornford@xxxxxxxxxxxxxx>
- Date: Fri, 7 Mar 2008 05:24:03 -0800 (PST)
On Mar 7, 8:06 am, Justin E. Miller wrote:
In XHTML 1.0 Strict, the correct declaration for calling
an external JavaScript is
<script type="text/javascript" src="script2.13.js" />
right?
That is a 'correct declaration' not "the correct declaration".
Running the validator on my page, I got it being correct as
either the preceding or <script type="text/javascript"
src="script2.13.js"></script>. I would figure one would want
to use the former considering it uses less bytes of data,
though largely irrelevant on most connections.
For genuine XHTML, where you have the choice, maybe.
I'm using Firefox 3.0 B3 and have noticed that the page
is blank, despite it passing validation by the W3 validator.
The same page works in Opera and Firefox 2.0.0.12 though.
Not unsurprisingly, it doesn't work in IE 6.
Given that IE 6 does not support XHTML at all that is not surprising.
I'm running Linux, so I can't run IE7 currently to test it
in there.
IE 7 does not support XHTML at all either, so there is no point. At
least there would be no point if what you were using was XHTML.
It seems to be a bug with the programs not handling the
XHTML+XML declaration,
Which "XHTML+XML declaration"? When served over HTTP(S) the only
significant declaration is the HTTP Content-Type header.
so I submitted a bug report to Mozilla. I just
wanted to see if it was just my computer screwing
things up.
It is neither a bug nor your computer. This is an author screw up.
I'm learning JavaScript through a book
Understandable, but not necessarily that good an idea.
that is using XHTML 1.0 Transitional
Oh dear.
and these are just scripts from that book. I changed the
code to be Strict because I prefer to use it.
They are online
at:http://www.justinandlindseymiller.com/javascript_work/index.html
The HTTP headers sent with that page include:-
HTTP/1.1 200 OK
Content-Length: 591
Date: Fri, 07 Mar 2008 12:53:33 GMT
Content-Type: text/html
ETag: "8002cefc-24f-47ce1a94"
Server: Apache/1.3.34 Ben-SSL/1.55
Last-Modified: Wed, 05 Mar 2008 03:59:16 GMT
And there I see a Content-Type header asserting the resource to be
"text/html", so not 'application/xhtml+xml'. Thus you page is not, and
never has been XHTML. The mark-up you are using is tag-soup HTML mark-
up. You are getting varying results because tag-soup HTML mark-up (and
particularly flavours that resemble XHTML) need the application of
error correction by the tag-soup HTML parser in order for them to be
represented as an HTML DOM (and rendered from that DOM). Error-
correction, being non-standardised (and non- standardisable), is more
or less effective in different browsers.
All you are saying in observing that Opera and Safari are handling
your particular flavour of tag-soup mark-up is that their tag-soup
parsers are more accommodating than those in IE or Firefox.
The pity of this is that it is a very common misconception that the
distinction between XHTML and HTML is determined by the mark-up used,
while in reality it is entirely down to the HTTP Content-Type headers
sent with the mark-up. From the scripting point of view this is an
important distinction because browsers receiving a 'text/html' will
build an HTML DOM to be scripted while browsers receiving an
'application/xhtml+xml' (assuming they can handle it at all) will
build an XHTML DOM. The two types of DOM are significantly distinct,
and distinct in a way that means that most non-trivial HTML DOM
scripts will not operate if they are exposed to an XHTML (and also the
reverse). Thus much mark-up that resembles XHTML (but is actually tag-
soup HTML because it is served as 'text/html' gets scripted in a way
that means in the even of the mark-up ever being interpreted as XHTML
(i.e. served as 'application/xhtml+xml') the web page in question will
instantly be rendered broken.
I would be willing to wager a month's income on the book you have that
used 'XHTML 1.0 Transitional' having demonstrated only HTML DOM
scripting. It certainly does not appear to have explained the
practical distinctions relating to scripting between XHTML and HTML to
you.
You are also going to have to go back to your Firefox bug report and
apologise for wasting everyone's time.
I don't need any feedback on it other than whether or not<snip>
it works in the browser you're using.
You are not necessarily the best judge of what you need in this
context.
.
- Follow-Ups:
- Re: Anyone else noticed this issue?
- From: Thomas 'PointedEars' Lahn
- Re: Anyone else noticed this issue?
- References:
- Anyone else noticed this issue?
- From: Justin E. Miller
- Anyone else noticed this issue?
- Prev by Date: Re: Don't understand flow using xmlhttp
- Next by Date: Re: Accessing the global object
- Previous by thread: Re: Anyone else noticed this issue?
- Next by thread: Re: Anyone else noticed this issue?
- Index(es):
Relevant Pages
|
Loading