HighDots Forums  

<script language="javascript" ..is correct in xhtml?

HTML Writing HTML for the Web (comp.infosystems.www.authoring.html)


Discuss <script language="javascript" ..is correct in xhtml? in the HTML forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
howa
 
Posts: n/a

Default <script language="javascript" ..is correct in xhtml? - 06-04-2008 , 12:17 PM






Just found a funny things..

in HTML4's dtd, http://www.w3.org/TR/html4/strict.dtd

language is not valid, i.e.

<!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 --
event CDATA #IMPLIED -- reserved for possible future
use --
for %URI; #IMPLIED -- reserved for possible future
use --
Quote:
But in XHTML, language is valid (although type is still required)


http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

<!ELEMENT script (#PCDATA)>
<!ATTLIST script
id ID #IMPLIED
charset %Charset; #IMPLIED
type %ContentType; #REQUIRED
language CDATA #IMPLIED
src %URI; #IMPLIED
defer (defer) #IMPLIED
xml:space (preserve) #FIXED 'preserve'
Quote:
Howard.



Reply With Quote
  #2  
Old   
C A Upsdell
 
Posts: n/a

Default Re: <script language="javascript" ..is correct in xhtml? - 06-04-2008 , 12:19 PM






howa wrote:
Quote:
Just found a funny things..

in HTML4's dtd, http://www.w3.org/TR/html4/strict.dtd

language is not valid, i.e.
You're comparing apples and oranges: strict and transitional.


Reply With Quote
  #3  
Old   
howa
 
Posts: n/a

Default Re: <script language="javascript" ..is correct in xhtml? - 06-04-2008 , 12:31 PM



On Jun 5, 1:19 am, C A Upsdell <cupsd... (AT) upsdell (DOT) invalid> wrote:
Quote:
howa wrote:
Just found a funny things..

in HTML4's dtd,http://www.w3.org/TR/html4/strict.dtd

language is not valid, i.e.

You're comparing apples and oranges: strict and transitional.
Oh...I have misread that!

So change the topic:

Why language is allowed in transitional, but not strict ?


Howard


Reply With Quote
  #4  
Old   
Rik Wasmus
 
Posts: n/a

Default Re: <script language="javascript" ..is correct in xhtml? - 06-04-2008 , 02:12 PM



On Wed, 04 Jun 2008 19:31:34 +0200, howa <howachen (AT) gmail (DOT) com> wrote:

Quote:
On Jun 5, 1:19 am, C A Upsdell <cupsd... (AT) upsdell (DOT) invalid> wrote:
howa wrote:
Just found a funny things..

in HTML4's dtd,http://www.w3.org/TR/html4/strict.dtd

language is not valid, i.e.

You're comparing apples and oranges: strict and transitional.

Oh...I have misread that!

So change the topic:

Why language is allowed in transitional, but not strict ?
Because it's deprecated, so it will be in many old documents, and while
TRANSITIONING to a new DTD/version, it can be many of them are still not
'caught'/altered. The moment of complete compliance, as soon as you're
done transitioning, you also have replaced all the language attributes
with type-attributes, and you can use STRICT. Using transitional for html
not transitioning is just silly...
--
Rik Wasmus
....spamrun finished


Reply With Quote
  #5  
Old   
howa
 
Posts: n/a

Default Re: <script language="javascript" ..is correct in xhtml? - 06-04-2008 , 10:35 PM



Hi

Quote:
Because it's deprecated, so it will be in many old documents, and while
TRANSITIONING to a new DTD/version, it can be many of them are still not
'caught'/altered. The moment of complete compliance, as soon as you're
done transitioning, you also have replaced all the language attributes
with type-attributes, and you can use STRICT. Using transitional for html
not transitioning is just silly...
--
Rik Wasmus
...spamrun finished
Interesting questions would be

1. Who created it? Why removed finally?
2. `type` is required even at HTML4 dtd, why people are only using
`language`? (Due to incorrect implementation of Dreamweaver /
Frontpage for example?)

Howard


Reply With Quote
  #6  
Old   
C A Upsdell
 
Posts: n/a

Default Re: <script language="javascript" ..is correct in xhtml? - 06-05-2008 , 12:21 AM



howa wrote:
Quote:
Because it's deprecated, so it will be in many old documents, and while
TRANSITIONING to a new DTD/version, it can be many of them are still not
'caught'/altered. The moment of complete compliance, as soon as you're
done transitioning, you also have replaced all the language attributes
with type-attributes, and you can use STRICT. Using transitional for html
not transitioning is just silly...
--
Rik Wasmus
...spamrun finished

Interesting questions would be

1. Who created it? Why removed finally?
2. `type` is required even at HTML4 dtd, why people are only using
`language`? (Due to incorrect implementation of Dreamweaver /
Frontpage for example?)
Netscape 4 did not support TYPE, so LANGUAGE had to be used until
Netscape 4 became extinct, and even when it had become extinct, many
people continued to use LANGUAGE, perhaps out of habit.





Reply With Quote
  #7  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: <script language="javascript" ..is correct in xhtml? - 06-05-2008 , 12:51 AM



Scripsit C A Upsdell:

Quote:
Netscape 4 did not support TYPE, so LANGUAGE had to be used until
Netscape 4 became extinct
Since Netscape only supported JavaScript as the scripting language, no
attribute was needed to tell it that the language is JavaScript.

The LANGUAGE attribute was introduced by Netscape to indicate JavaScript
_version_, and if you wish to do that, you still need that attribute,
since the TYPE attribute does not allow that. (More exactly, the
Internet media types for JavaScript do not allow any version to be
specified.)

It was (and still is) possible to write e.g. one SCRIPT element with
LANGUAGE="JavaScript1.2" and another one with LANGUAGE="JavaScript1.3"
so that a browser that only supports JavaScript 1.2 ignores the latter.
This was never a particularly good idea, but that's the story behind
LANGUAGE.

In practice, neither TYPE nor LANGUAGE is needed, since browsers assume
by default that the language is JavaScript. But if you do specify one of
those attributes and with a _wrong_ (e.g., misspelled) value, your
script may well be ignored.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #8  
Old   
howa
 
Posts: n/a

Default Re: <script language="javascript" ..is correct in xhtml? - 06-05-2008 , 01:28 AM



On 6$B7n(B5$BF|(B, $B2<8a(B1$B;~(B21$BJ,(B, C A Upsdell <cupsd... (AT) upsdell (DOT) invalid> wrote:
Quote:
howa wrote:

Netscape 4 did not support TYPE, so LANGUAGE had to be used until
Netscape 4 became extinct, and even when it had become extinct, many
people continued to use LANGUAGE, perhaps out of habit.
Definitely a bad habit, even Mozilla don't use LANGUAGE in their web
site now.

Howard


Reply With Quote
  #9  
Old   
C A Upsdell
 
Posts: n/a

Default Re: <script language="javascript" ..is correct in xhtml? - 06-05-2008 , 12:14 PM



Jukka K. Korpela wrote:
Quote:
Scripsit C A Upsdell:

Netscape 4 did not support TYPE, so LANGUAGE had to be used until
Netscape 4 became extinct

Since Netscape only supported JavaScript as the scripting language, no
attribute was needed to tell it that the language is JavaScript.
It was actually more complex than that. Netscape 4 was rife with bugs,
some of which appeared in most (or all) versions of Netscape 4, and some
of which appeared only in certain versions. And one of the bugs was
that, when the LANGUAGE attribute was not specified, Netscape would
*sometimes* parse the HTML improperly.

I never did figure out all the factors which led Netscape 4 to misbehave
-- there were SO many -- but I did discover some common factors, and I
developed defensive design techniques which minimized the problems. One
defensive technique was to always include the LANGUAGE attributes. No
doubt there were many cases where it did not matter, but designing
defensively minimized the instances when it did, saving me much time.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.