Putting "javascript:" in front of code?

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

    #16
    Re: Putting "javascrip t:" in front of code?

    Michael Winter said:
    [color=blue]
    >The original question was: Is "javascript:som e_javascript_co de"
    >syntacticall y correct? The answer is yes. But leaving it at that
    >neglects the assumption upon which the inclusion of "javascript :" is
    >based. Some authors that post to this group attach a special meaning
    >to that string in an intrinsic event, and that association needs to
    >be dispelled.[/color]

    Certainly, but not by replacing it with the false belief that
    it is incorrect JavaScript. The message that you responded
    to had made the actual facts clear. You muddied the waters
    by suggesting that his explanation was wrong.

    Comment

    • Jim Ley

      #17
      Re: Putting "javascrip t:" in front of code?

      On Sun, 07 Dec 2003 02:11:17 GMT, Michael Winter
      <M.Winter@bluey onder.co.invali d> wrote:
      [color=blue]
      >Jim Ley wrote on 06 Dec 2003:
      >The HTML specification itself uses text/javascript as the MIME type
      >for JavaScript (though that doesn't necessarily make it correct).[/color]

      Good for it, it has no change control or anything else over
      javascript, The HTML WG has no more status than me or you on what is
      the mime-type for js, you'll note the SVG WG say it's text/ecmascript.

      [color=blue]
      >However, as neither types
      >have been registered, neither browser is correct.[/color]

      You don't seem to understand the x- tree, whilst you shouldn't use an
      x-tree in public really, there we'ren't vnd. trees for it to go, there
      is nothing wrong in using an x-tree.
      [color=blue]
      >I don't know what
      >various browsers consider the proper JavaScript MIME type. However, I
      >do agree that an application type is the better choice.[/color]

      No it's not, it's a private namespace for development/experimental
      purposes and should only be used by agreement of what it means at
      boths ends, that's never happened. x-trees should not be used on the
      web, and they should not be used at all now (the vnd. and prs. trees
      are better for what it achieves)
      [color=blue][color=green][color=darkred]
      >>>If you omit either the header or META element, but use intrinsic
      >>>events, your HTML document is invalid.[/color]
      >>
      >> No, invalid has a technical meaning in HTML, and that does not
      >> make it invalid, it may make it a non-conforming HTML 4
      >> document, but then that's only a tiny subset of HTML. ( RFC
      >> 2854 blesses all tag-soup to be html)[/color]
      >
      >Do the semantics really matter?[/color]

      Yes, the meaning of VALID matters, the more important fact though is
      it is only HTML 4 where the above rules come into play, as most people
      author tag-soup, or other HTML types, the rules do not exist.

      Jim.
      --
      comp.lang.javas cript FAQ - http://jibbering.com/faq/

      Comment

      • Michael Winter

        #18
        Re: Putting &quot;javascrip t:&quot; in front of code?

        Jim Ley wrote on 07 Dec 2003:
        [color=blue]
        > On Sun, 07 Dec 2003 02:11:17 GMT, Michael Winter
        > <M.Winter@bluey onder.co.invali d> wrote:
        >[color=green]
        >>Jim Ley wrote on 06 Dec 2003:
        >>The HTML specification itself uses text/javascript as the MIME
        >>type for JavaScript (though that doesn't necessarily make it
        >>correct).[/color]
        >
        > Good for it, it has no change control or anything else over
        > javascript, The HTML WG has no more status than me or you on
        > what is the mime-type for js, you'll note the SVG WG say it's
        > text/ecmascript.[/color]

        That's why I said: "though that doesn't necessarily make it correct".
        I realise that they have no say over the MIME type for JS. However, I
        would of thought that they made the decision to use that type in
        their specifications for a good reason.

        <snip>
        [color=blue][color=green]
        >>I don't know what
        >>various browsers consider the proper JavaScript MIME type.
        >>However, I do agree that an application type is the better
        >>choice.[/color]
        >
        > No it's not, it's a private namespace for
        > development/experimental purposes and should only be used by
        > agreement of what it means at boths ends, that's never happened.
        > x-trees should not be used on the web, and they should not be
        > used at all now (the vnd. and prs. trees are better for what it
        > achieves)[/color]

        Where in that paragraph (specifically that last sentence) do I
        mention application/x-javascript?
        [color=blue]
        > Yes, the meaning of VALID matters, the more important fact
        > though is it is only HTML 4 where the above rules come into
        > play, as most people author tag-soup, or other HTML types, the
        > rules do not exist.[/color]

        As you say, most people write tag soup. It stands to reason that most
        wouldn't understand (or care about) the distinction between invalid
        and incorrect. I used 'invalid' as a synonym of wrong. It didn't
        occur to me at the time that it could be interpreted any other way.
        It is for that reason that I refer (and anticipate references) to
        validation of a HTML document explictly.

        Mike

        --
        Michael Winter
        M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk")

        Comment

        • Jim Ley

          #19
          Re: Putting &quot;javascrip t:&quot; in front of code?

          On Sun, 07 Dec 2003 13:31:41 GMT, Michael Winter
          <M.Winter@bluey onder.co.invali d> wrote:
          [color=blue]
          >That's why I said: "though that doesn't necessarily make it correct".
          >I realise that they have no say over the MIME type for JS. However, I
          >would of thought that they made the decision to use that type in
          >their specifications for a good reason.[/color]

          Such as? - If the reason is "it's what works in current UA's" then
          others are free to argue that the defaulting to ecmascript for
          intrinsic events is just as legitimate.
          [color=blue]
          >Where in that paragraph (specifically that last sentence) do I
          >mention application/x-javascript?[/color]

          sorry, I misread an "an" for a "the" there, and thought you were
          talking about the x-javascript one.

          Jim.
          --
          comp.lang.javas cript FAQ - http://jibbering.com/faq/

          Comment

          • Thomas 'PointedEars' Lahn

            #20
            Re: Putting &quot;javascrip t:&quot; in front of code?

            Jim Ley wrote:
            [color=blue]
            > Michael Winter wrote:[color=green]
            >> The HTML specification itself uses text/javascript as the MIME type
            >> for JavaScript (though that doesn't necessarily make it correct).[/color]
            >
            > Good for it, it has no change control or anything else over
            > javascript,[/color]

            It is used in the Recommendation because it is widely supported.
            [color=blue]
            > The HTML WG has no more status than me or you on what is the mime-type
            > for js, you'll note the SVG WG say it's text/ecmascript.[/color]

            You know that text/ecmascript targets a different language. Besides,
            that is not standardized as well. Since the W3C does not watch over
            either ECMAScript or JavaScript, as you wrote before (but ECMA does),
            one of W3C's working groups is not the appropriate standardization
            board to decide what is the proper MIME type for JavaScript. And last
            but not least, what about



            ?


            PointedEars
            --
            The Internet is filled with people trying to make a name for themselves by
            breaking your code, crashing your site, posting inappropriate content, and
            otherwise making your day interesting. (from: The PHP manual, 5. Security)

            Comment

            • Thomas 'PointedEars' Lahn

              #21
              Re: Putting &quot;javascrip t:&quot; in front of code?

              Janwillem Borleffs wrote:
              [color=blue]
              > <delerious@no.s pam.com> schreef in bericht
              > news:3fd198f8.1 0126601@news.md .comcast.gigane ws.com...[/color]

              Please shorten your attribution to one line, leaving
              out information not vital to follow the discussion.
              [color=blue][color=green]
              >> I see some code examples like this:
              >>
              >> <DIV onmouseover="th is.style.backgr ound='blue'">
              >>
              >> and other code examples like this:
              >>
              >> <DIV onmouseover="ja vascript:this.s tyle.background ='blue'">
              >>
              >> Which way is more proper? Or are both ways perfectly fine? Are there any
              >> specifications that discuss when "javascript :" should be put in front of[/color]
              > code?[/color]
              ^^
              OE Quotefix repairs borken quotes. OTOH, you could switch
              to NetNews client software that works by default.
              [color=blue]
              > The first one is the proper way,[/color]

              The statement is correct.
              [color=blue]
              > because the onmouseover attribute (and other event handlers)
              > expects the value to contain JS code only.[/color]

              However, the explanation is awfully wrong.

              First, values of the intrinsic event handler attributes may be of *any*
              script language. The default script language can be specified with the

              <meta http-equiv="Content-Script-Type" content="...">

              element, defining it with the value of the `content' attribute. For
              JavaScript, a value of `text/javascript' is appropriate.

              The default script language is text/javascript in Mozilla/5.0 and
              JScript (text/jscript?) in Internet Explorer.


              Second, the `javascript:' within the event handler is considered one of
              the following:

              A) UAs using the IE browser component: A label specifying the script
              language
              B) Other UAs: A label that is ignored since no statement refers to it.
              C) Incorrect syntax, which triggers a script error.

              *That* is why it is wrong.
              [color=blue]
              > What you will also see very often, is the usage of the javascript: pseudo
              > protocol in anchors:[/color]

              Third, `javascript:' is not a pseudo protocol (I would like give the
              person who introduced that ridiculous term a good kick in the ass),
              but an URI scheme.


              PointedEars

              Comment

              • Thomas 'PointedEars' Lahn

                #22
                Re: Putting &quot;javascrip t:&quot; in front of code?

                Jim Ley wrote:
                [color=blue]
                > Michael Winter wrote:[color=green]
                >> For JavaScript, the MIME type is text/javascript [...][/color]
                >
                > Could you cite the relevant RFC which indicates this please? for
                > JavaScript (capatilised like that) the relevant one would be
                > application/x-javascript surely?[/color]

                No for both answers. Alas, there is no standardized MIME type for
                JavaScript code. Nevertheless, text/javascript is, in contrast to
                application/x-javascript, widely supported and therefore used in
                the HTML 4.01 Specification itself.


                PointedEars

                Comment

                • Lasse Reichstein Nielsen

                  #23
                  Re: Putting &quot;javascrip t:&quot; in front of code?

                  Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:
                  [color=blue]
                  > The default script language is text/javascript in Mozilla/5.0 and
                  > JScript (text/jscript?) in Internet Explorer.[/color]

                  Both text/jscript and text/javascript will work in IE. They both
                  trigger the same (JScrip) interpreter.
                  [color=blue]
                  > Second, the `javascript:' within the event handler is considered one of
                  > the following:
                  >
                  > A) UAs using the IE browser component: A label specifying the script
                  > language
                  > B) Other UAs: A label that is ignored since no statement refers to it.[/color]

                  It can, but then it will fail in IE.
                  [color=blue]
                  > C) Incorrect syntax, which triggers a script error.[/color]

                  Which will not happen in any browser I have seen, since it would require
                  the browser to interpret the contents as something other than Javascript,
                  and only IE allows other languages at all.
                  [color=blue]
                  > *That* is why it is wrong.[/color]

                  For some value of "wrong" :)
                  [color=blue]
                  > Third, `javascript:' is not a pseudo protocol (I would like give the
                  > person who introduced that ridiculous term a good kick in the ass),
                  > but an URI scheme.[/color]

                  So, http is a protocol, but http: is an URI scheme, correct?

                  /L
                  --
                  Lasse Reichstein Nielsen - lrn@hotpop.com
                  DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                  'Faith without judgement merely degrades the spirit divine.'

                  Comment

                  • Jim Ley

                    #24
                    Re: Putting &quot;javascrip t:&quot; in front of code?

                    On Mon, 08 Dec 2003 00:56:36 +0100, Thomas 'PointedEars' Lahn
                    <PointedEars@we b.de> wrote:
                    [color=blue]
                    >It is used in the Recommendation because it is widely supported.[/color]

                    That doesn't work, so are lots of HTML features not included in the
                    spec.
                    [color=blue][color=green]
                    >> The HTML WG has no more status than me or you on what is the mime-type
                    >> for js, you'll note the SVG WG say it's text/ecmascript.[/color]
                    >
                    >You know that text/ecmascript targets a different language.[/color]

                    WHAT? what "different language" does it target?
                    [color=blue]
                    > Besides, that is not standardized as well.[/color]

                    Indeed, but it's widely supported... these should not be using any
                    examples that are wrong.
                    [color=blue]
                    > http://lists.w3.org/Archives/Public/...2Aug/0008.html[/color]

                    What about it? It's not different to what I was arguing here, it's
                    wrong for W3 WG's to recommend unregistered mime-types not in the x-
                    tree.

                    Jim.
                    --
                    comp.lang.javas cript FAQ - http://jibbering.com/faq/

                    Comment

                    • Richard Cornford

                      #25
                      Re: Putting &quot;javascrip t:&quot; in front of code?

                      "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
                      news:y8tom9j6.f sf@hotpop.com.. .
                      <snip>[color=blue][color=green]
                      >>C) Incorrect syntax, which triggers a script error.[/color]
                      >
                      >Which will not happen in any browser I have seen, since it would
                      >require the browser to interpret the contents as something other
                      >than Javascript, and only IE allows other languages at all.[/color]
                      <snip>

                      According to my Netscape JavaScript 1.5 reference labels were introduced
                      in JavaScript 1.2 so in principal an environment supporting only
                      JavaScript <= 1.1 probably will consider event handling attribute code
                      prefixed with "javascript :" as a syntax error. But then, anyone still
                      using a JavaScript <= 1.1. UA is likely to be finding its use nearly
                      totally unproductive anyway.

                      Richard.


                      Comment

                      • Dr John Stockton

                        #26
                        Re: Putting &quot;javascrip t:&quot; in front of code?

                        JRS: In article <3FD3B9E6.10104 01@PointedEars. de>, seen in
                        news:comp.lang. javascript, Thomas 'PointedEars' Lahn
                        <PointedEars@we b.de> posted at Mon, 8 Dec 2003 00:38:14 :-[color=blue]
                        >Janwillem Borleffs wrote:
                        >[color=green]
                        >> <delerious@no.s pam.com> schreef in bericht
                        >> news:3fd198f8.1 0126601@news.md .comcast.gigane ws.com...[/color]
                        >
                        >Please shorten your attribution to one line, leaving
                        >out information not vital to follow the discussion.[/color]

                        Please stop nagging on this matter.

                        There is no known support for your attitude in applicable standards
                        documents; nor in the Newsgroup FAQ.

                        Please also include in your own attributions sufficient material to put
                        the quoted material fully in context for those using off-line
                        newsreaders, when re-quoted in a further response.

                        --
                        © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME ©
                        Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
                        Web <URL:http://www.merlyn.demo n.co.uk/news-use.htm> : about usage of News.
                        No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

                        Comment

                        Working...