Uppercase or Lowercase?

K

Krij

Hi!

I wonder: is '<SCRIPT TYPE="TEXT/JAVASCRIPT1.2">' a correct way of
starting? Or should it be kept in lowercase?
 
D

Danny

Krij said:
Hi!

I wonder: is '<SCRIPT TYPE="TEXT/JAVASCRIPT1.2">' a correct way of
starting? Or should it be kept in lowercase?

There's no text/javascript1.2 or anything like that, as for casing, stick with lowercase and
you're fine :), though it doesn't quite matter for the sake of <script> but it may depending on
document DTD used.


Danny
 
R

RobG

Krij said:
Hi!

I wonder: is '<SCRIPT TYPE="TEXT/JAVASCRIPT1.2">' a correct way of
starting? Or should it be kept in lowercase?

The case of tag and attribute names is irrelevant in HTML, it matters
greatly in XML (and hence XHTML).

The case sensitivity of the attribute's value depends on the attribute
- a script element's type attribute is case insensitive.

However, the *value* of the script element's type attribute is
extremely important: any value other than 'text/javascript' will cause
many browsers to ignore the content. You are actually better off to
leave the value empty or not have the attribute at all, in which case
browsers (in most circumstances) will assume JavaScript or JScript
(noting that validators will take exception to missing required
attributes).
 
R

RobG

Danny said:
There's no text/javascript1.2 or anything like that,

Yes, there is - there was a version 1.2 of JavaScript which one sees
used from time to time as the value of the (deprecated) language
attribute. Using it there can have serious ramifications depending on
the browser. Using it as the value of the type attribute has possibly
more serious ramifications because it will stop the script content from
being executed at all in some browsers but not others.

Whether one effect is more serious than the other is moot.

as for casing, stick with lowercase and
you're fine :), though it doesn't quite matter for the sake of <script> but it may depending on
document DTD used.

The HTML 4 Strict DTD does not define any values for a script element's
type attribute, nor the case of tags or attribute names. HTML 4 is
case insensitive:

<URL: http://www.w3.org/TR/html4/intro/sgmltut.html >

The case sensitivity of attribute values is defined in the HTML
specification, not the DTD.

<URL: http://www.w3.org/TR/html4/interact/scripts.html#edef-SCRIPT >
 
K

Krij

RobG skrev:
Yes, there is - there was a version 1.2 of JavaScript which one sees
used from time to time as the value of the (deprecated) language
attribute. Using it there can have serious ramifications depending on
the browser. Using it as the value of the type attribute has possibly
more serious ramifications because it will stop the script content from
being executed at all in some browsers but not others.

Whether one effect is more serious than the other is moot.



The HTML 4 Strict DTD does not define any values for a script element's
type attribute, nor the case of tags or attribute names. HTML 4 is
case insensitive:

<URL: http://www.w3.org/TR/html4/intro/sgmltut.html >

The case sensitivity of attribute values is defined in the HTML
specification, not the DTD.

<URL: http://www.w3.org/TR/html4/interact/scripts.html#edef-SCRIPT >

Hi!

Thanks for answering. Yes, of course I meant: '<SCRIPT
TYPE="TEXT/JAVASCRIPT"> without the value id.

Had a discussion with my teacher on this subject. He gave me incorrect
answer on a test I did. He meant that lowercase is the recommended way
to go. Couldn't find any in the JavaScript 1.5 book I used so I argued
against :)

Geir Smevig-Baardsen
MCP
http://www.geirb.info
*******************
*Don't reply to my
*email.
*Reply to group
*:)
*
*
*******************
 
R

Randy Webb

RobG said the following on 7/26/2006 1:52 AM:
The case of tag and attribute names is irrelevant in HTML, it matters
greatly in XML (and hence XHTML).

And since 90% of the browsers on the web don't understand xHTML, its not
a big issue is it?
The case sensitivity of the attribute's value depends on the attribute
- a script element's type attribute is case insensitive.

Nor is the mime type people use defined anywhere.
However, the *value* of the script element's type attribute is
extremely important: any value other than 'text/javascript' will cause
many browsers to ignore the content. You are actually better off to
leave the value empty or not have the attribute at all, in which case
browsers (in most circumstances) will assume JavaScript or JScript
(noting that validators will take exception to missing required
attributes).

Aside from the validators, the only UA that *might* get confused by a
<script> tag would be IE and that is in limited circumstances.
 
K

Krij

Randy Webb skrev:
RobG said the following on 7/26/2006 1:52 AM:

And since 90% of the browsers on the web don't understand xHTML, its not
a big issue is it?


Nor is the mime type people use defined anywhere.


Aside from the validators, the only UA that *might* get confused by a
<script> tag would be IE and that is in limited circumstances.

Hi!

And finally a light seems to shine in the horizon. What are we
discussing here?
Of course not JavaScript. JS contains no tags, as I understand. So it
has to be HTML. I pointed this out to my teacher and he finally agreed.
Tags in HTML 4.0 ++ are case insensitive, as another in this thread
pointed out.

Thanks to all :)

Geir Smevig-Baardsen
MCP
http://www.geirb.info
*******************
*Don't reply to my
*email.
*Reply to group
*:)
*
*
*******************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top