"language=Javascript" -- not validating

T

TheKeith

Why is this not validating properly? Is this excluded from the html 4.01
spec? Should I just use <script type="text/javascript"> without the language
attribute? Thanks.
 
A

Adrienne

Why is this not validating properly? Is this excluded from the html
4.01 spec? Should I just use <script type="text/javascript"> without
the language attribute? Thanks.

Yes.
 
B

brucie

[ "language=Javascript" ]
Why is this not validating properly?

language = cdata [CI]
Deprecated. This attribute specifies the scripting language of the
contents of this element. Its value is an identifier for the language,
but since these identifiers are not standard, this attribute has been
deprecated in favor of type.
Is this excluded from the html 4.01 spec?

yes

<!ELEMENT SCRIPT - - %Script; -- script statements -->
<!ATTLIST SCRIPT
charset %Charset; #IMPLIED -- char encoding of linked resource --
type %ContentType; #REQUIRED -- content type of script language --
src %URI; #IMPLIED -- URI for an external script --
defer (defer) #IMPLIED -- UA may defer execution of script --
Should I just use <script type="text/javascript"> without the language
attribute?

yes

type = content-type [CI]
This attribute specifies the scripting language of the element's
contents and overrides the default scripting language. The scripting
language is specified as a content type (e.g., "text/javascript").
Authors must supply a value for this attribute. There is no default
value for this attribute.

18.2.1 The SCRIPT element
http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.1
 
H

Hywel Jenkins

Why is this not validating properly? Is this excluded from the html 4.01
spec? Should I just use <script type="text/javascript"> without the language
attribute? Thanks.
Would it not have been worth trying, just to see if your hunch was
correct?
 
R

Richard

Would it not have been worth trying, just to see if your hunch was
correct?

Heaven forbid! That requires thought!
"I think, therefor I am not a politician."
 
T

TheKeith

Richard said:
Heaven forbid! That requires thought!
"I think, therefor I am not a politician."

I did that first smart ass, but I wasn't sure if it might cause some
unforeseen problems.
 
C

cwdjr

Yes, for a new page, you should only use "type" and not "language"
instead of or in addition to "type". I believe that in html 3.2 you
could use script alone, although many added language. With html 4 use
of type became required to validate at the W3C html validator as
html4. The last time I checked, you could add language in addition to
type at html 4.01 transitional, but I have not validated at this level
for so long that things could have changed. I do know that use of
language in the script tag, even when type is present, gets you a
validation error in xhtml 1.1. I think use of language in the script
tag in addition to type also is taboo at xhtml 1.0 strict, but again I
have not checked this in a long time. JS has been used many years now,
and many write it and the script tag as they learned it several years
ago. Many current browsers still accept the older ways of doing
things. I have seen large commercial site codes that have had much new
code added over several years. In them you sometimes find a mix of
script tags that use all possibe combinations of script, language, and
type that have been used over the years.
 

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

No members online now.

Forum statistics

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

Latest Threads

Top