Peter said:
I just tested the w3c validator and of course you are correct.
I am glad I didn't state it as fact.
But it is a fact, both specifically (assuming your hearsay report of
what Douglas said is accurate) and generally: it is not necessary to
include a TYPE attribute in a SCRIPT opening tag. It is just also true
that it is not possible to omit the TYPE attribute and create a formally
valid HTML document. Neither excludes the other because they speak of
different things.
Perhaps I've learned that all JavaScript related
information really does have to be verified.
That will do you no harm.
Very interesting. Thanks for the info. I wonder if things
have changed in the last few years.
A very significant change happened this year, in that official MIME
types for javascript were introduced (after an absence of 10 years,
which seems to explain why browsers were not interested in what MIME
type appeared in content type headers).
Either way, it doesn't really matter because I
would like my documents to validate and I imagine
including the type attribute can only act as a safety
net.
It is probably also a very good idea to send an appropriate MIME type in
content-type headers along with imported javascript. They may be ignored
at present but now there are official values the likelihood is that the
future will see browsers that take notice of them. And anyway, doing the
whole job, in sending content over HTTP to a client, isn't finished
until you are sending appropriate HTTP (including content-type) headers
with everything. Leaving it to a blend of random chance and the default
configuration of servers is just not professional.
Richard.