On Thu, 19 Feb 2004 10:12:59 +0100, Erwin Moller
<si******************************************@spam yourself.com> wrote:
I am a bit cconfused with the different tags I encounter to start a
script.
I used to use: language="Javascript"
Bad.
Nowadays I use: type="text/javascript"
Very good.
I did see some javascript1.2 (i think) too, but never used that.
Oh so wrong! Specifying a version seems to cause odd parsing rules to be
invoked (for example, = meaning assignment *and* equal to[1]) and limiting
the available methods and properties that are available. Most people don't
understand the consequences of either.
But when I let my favorite editor (Eclipse) do some codecompletion I get:
<script language="JavaScript" type="text/javascript"
src="jsfile.js"></script>
My editor used to do that, but I fixed it. I don't know if you can in
Eclipse - look in the preferences.
Forget about the src for a moment.
I see 2 definition in the same tag.
Is that ok?
The language attribute is deprecated. Last week, I went on a trek through
the older HTML specifications to see exactly when this deprecation
occurred. This is what I found:
In version 2.0, there was no SCRIPT element.
In version 3.2, there were no formal attributes to the SCRIPT element.
In version 4.0, all of the current attributes were present, and language
was already deprecated.
What I conclude from that is that the language attribute was proprietary
(at a guess, probably Netscape) and was never a recommended part of the
HTML language. When the need to specify the scripting language was
identified, it was determined that the language attribute was inadequate
(values were inconsistent) so it was added to the specification, but at a
deprecated status. The type attribute, using MIME type values, was
recommended in its place. As such, it has never really been OK to use it,
apart from in the early days of version 4.0 and earlier, though strictly
for backward-compatibility purposes only.
[If I am totally off the mark, or if there is further information on this
subject, I would be interested in hearing it.]
And on a sidenote: Am I safe when I use the modern type="text/javascript"
only? The answer probably depends on the browser.
The type attribute is not modern. It first appeared in v4.0, which was
released just over six years ago. You will not encounter any problems
using it[2].
Where can I find some coherent information?
Just follow the specifications. In everything, that is the best you can
do. If there is an identified problem (such as IE's general lack of
standards support), then you should embark on a workaround for that
situation. I don't think it is, or should be, the author's job to cope for
broken or obsolete browsers (unless it is really in the interest of the
project).
That would be my assessment. Not normative, nor necessarily recommended,
by any stretch of the imagination.
Mike
[1] Mentioned by Randy Webb in an off-topic (at the time) discussion with
Richard Cornford and Lasse Nielsen.
[2] Even if a browser doesn't understand type, it is fairly guaranteed
that the browser will default to JavaScript anyway.
--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)