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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • howa

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

    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 --
    >
    But in XHTML, language is valid (although type is still required)




    <!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'
    >
    Howard.

  • C A Upsdell

    #2
    Re: &lt;script language=&quot; javascript&quot ; ..is correct in xhtml?

    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.

    Comment

    • howa

      #3
      Re: &lt;script language=&quot; javascript&quot ; ..is correct in xhtml?

      On Jun 5, 1:19 am, C A Upsdell <cupsd...@upsde ll.invalidwrote :
      howa wrote:
      Just found a funny things..
      >>
      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

      Comment

      • Rik Wasmus

        #4
        Re: &lt;script language=&quot; javascript&quot ; ..is correct in xhtml?

        On Wed, 04 Jun 2008 19:31:34 +0200, howa <howachen@gmail .comwrote:
        On Jun 5, 1:19 am, C A Upsdell <cupsd...@upsde ll.invalidwrote :
        >howa wrote:
        Just found a funny things..
        >>>>
        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

        Comment

        • howa

          #5
          Re: &lt;script language=&quot; javascript&quot ; ..is correct in xhtml?

          Hi
          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

          Comment

          • C A Upsdell

            #6
            Re: &lt;script language=&quot; javascript&quot ; ..is correct in xhtml?

            howa wrote:
            >Because it's deprecated, so it will be in many old documents, and while
            >TRANSITIONIN G 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.



            Comment

            • Jukka K. Korpela

              #7
              Re: &lt;script language=&quot; javascript&quot ; ..is correct in xhtml?

              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.

              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="JavaS cript1.2" and another one with LANGUAGE="JavaS cript1.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")


              Comment

              • howa

                #8
                Re: &lt;script language=&quot; javascript&quot ; ..is correct in xhtml?

                On 6$B7n(B5$BF| (B, $B2<8a(B1$B; ~(B21$BJ,(B, C A Upsdell <cupsd...@upsde ll.invalidwrote :
                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

                Comment

                • C A Upsdell

                  #9
                  Re: &lt;script language=&quot; javascript&quot ; ..is correct in xhtml?

                  Jukka K. Korpela wrote:
                  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.

                  Comment

                  Working...