Top warning signs of bad code?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas 'PointedEars' Lahn

    Re: Top warning signs of bad code?

    Richard Cornford wrote:
    [color=blue]
    > Thomas 'PointedEars' Lahn wrote:[color=green]
    >> Richard Cornford wrote:[color=darkred]
    >>> href="javascrip t:somefunction( )" -wouldn't appear in HTML written
    >>> by the informed/experienced, so
    >>> can be stated as bad.[/color]
    >> Intrinsic event handler attributes have been introduced in HTML 4.01[/color]
    >
    > They were not introduced, they were formalised, and in the December 1997
    > draft of HTML 4.0 according to the HTML specs. That does not mean that
    > they will be unavailable on HTML 3.2 user agents.[/color]

    The fact that "It is inappropriate to use W3C Working Drafts as reference
    material or to cite them as other than 'work in progress'." aside[1],
    "HTML 3.2 aims to capture recommended practice as of early [19]96 [...]"[2]
    Therefore, it is, on the contrary, highly likely that HTML 3.2 user agents
    do not support intrinsic event handler attributes.

    [1] <http://www.w3.org/TR/WD-html40-970917/>
    [2] <http://www.w3.org/TR/REC-html32>
    [color=blue][color=green]
    >> and will not work in HTML 3.2 user agents,[/color]
    >
    > Then you can name those user agents?[/color]

    Probably, but I don't have to (prove anything regarding this matter).
    [color=blue][color=green]
    >> while a `javascript:' URI will work.[/color]
    >
    > Javascript URIs have never worked on UAs that do not support scripting
    > with javascript.[/color]

    Of course not, and I have never claimed that the opposite is true.
    However, code like

    <script type="text/javascript">
    document.write(
    '<a href="javascrip t:foobar()" onclick="foobar ();'
    + ' return false;">foobar< \/a>');
    </script>

    is possible and, even more, it provides a way of clean degradation.
    [color=blue][color=green]
    >> Exactly the informed/experienced will use the above
    >> construct to support HTML 3.2 user agents, too,[/color]
    >
    > No they won't. The attempt would not result in clean degradation on
    > unscriptable HTML 3.2 UAs (probably the majority of such browsers)
    > [...][/color]

    It would, see above.
    [color=blue][color=green]
    >> i.e. your statement is false.[/color]
    >
    > Not as worded.[/color]

    Of course as worded.
    [color=blue]
    > <snip>[color=green]
    >> The presence of javascript: URIs in source code alone
    >> cannot be considered an indicator for bad style;[/color]
    >
    > HTML source code is specified in my statement.[/color]

    Writing HTML source code is possible with client-side scripting.
    You stated that the above source code "wouldn't appear in HTML
    written by the informed/experienced" which is obviously false.
    [color=blue][color=green]
    >> that depends on the context.[/color]
    > <snip>
    >
    > The context of providing bookmarkable javascript URIs is the only
    > reasonable example of there use in HTML [...][/color]

    No, it is not.


    PointedEars
    --
    If at first you don't succeed, call it version 1.0

    Comment

    • Lasse Reichstein Nielsen

      Re: Top warning signs of bad code?

      Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:
      [color=blue]
      > Richard Cornford wrote:
      >[color=green]
      >> Thomas 'PointedEars' Lahn wrote:[/color][/color]
      [color=blue][color=green][color=darkred]
      >>> and will not work in HTML 3.2 user agents,[/color]
      >>
      >> Then you can name those user agents?[/color]
      >
      > Probably, but I don't have to (prove anything regarding this matter).[/color]

      Then I will say, without any formal backing either, that there are
      *no* HTML 3.2 agents (being a client that understands only HTML 3.2
      and not HTML 4). If there is a client that understands both Javascript
      and HTML 3.2, then it also understands intrinsic event handlers.

      Ofcourse, a negative is hard to prove, so I won't :)

      Ok, a little research:
      IE 3 was a HTML 3 browser, not 3.2. No scripting.
      IE 4 supports intrinsic event handlers.
      Netscape 2 supports intrinsic event handlers.
      Opera 3.21 supports intrinsic event handlers.
      That is, for each of these browsers, the first major version to
      support scripting at all, also supports intrinsic event handlers.

      /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

      • Richard Cornford

        Re: Top warning signs of bad code?

        Thomas 'PointedEars' Lahn wrote:[color=blue]
        > Richard Cornford wrote:[color=green]
        >> Thomas 'PointedEars' Lahn wrote:[color=darkred]
        >>> Richard Cornford wrote:
        >>>>href="javas cript:somefunct ion()" -wouldn't appear in HTML written
        >>>> by the informed/experienced, so
        >>>> can be stated as bad.
        >>>
        >>> Intrinsic event handler attributes have been introduced in
        >>> HTML 4.01[/color]
        >>
        >> They were not introduced, they were formalised, and in the December
        >> 1997 draft of HTML 4.0 according to the HTML specs. That does not
        >> mean that they will be unavailable on HTML 3.2 user agents.[/color]
        >
        > The fact that "It is inappropriate to use W3C Working Drafts as
        > reference material or to cite them as other than 'work in progress'."
        > aside[1], "HTML 3.2 aims to capture recommended practice as of early
        > [19]96 [...]"[2] Therefore, it is, on the contrary, highly likely
        > that HTML 3.2 user agents do not support intrinsic event handler
        > attributes.[/color]

        Exactly how many scriptable web browsers existed in early 1996? One?

        The point of referencing the December 1997 draft of HTML 4.0 is to show
        a date by which it was considered worth formalising intrinsic event
        handlers. It demonstrates that intrinsic events predate that draft. That
        document's status does not modify its historical value in this respect.

        <snip>[color=blue][color=green][color=darkred]
        >>> and will not work in HTML 3.2 user agents,[/color]
        >>
        >> Then you can name those user agents?[/color]
        >
        > Probably, but I don't have to (prove anything
        > regarding this matter).[/color]

        In the event that there are no scriptable HTML web browsers that would
        not understand an onclick event handler in a context where they would
        understand href="javascirp t: ... " then your whole point is completely
        worthless. As nobody else believes these browsers ever exited it is your
        responsibility to back up your assertion by citing a (any) specific
        browser. (You might still be asked why anyone scripting in 2004 should
        be considering a browser that would have been minor nearly a decade ago,
        but if no such browser exists there is no point even considering that.)
        [color=blue][color=green][color=darkred]
        >>> while a `javascript:' URI will work.[/color]
        >>
        >> Javascript URIs have never worked on UAs that do not support
        >> scripting with javascript.[/color]
        >
        > Of course not, and I have never claimed that the opposite
        > is true.[/color]

        Beyond the use of the words "will work" unqualified in the above
        statement, referring to "HTML 3.2 user agents" (also unqualified).
        [color=blue]
        > However, code like
        >
        > <script type="text/javascript">
        > document.write(
        > '<a href="javascrip t:foobar()" onclick="foobar ();'
        > + ' return false;">foobar< \/a>');
        > </script>
        >
        > is possible and, even more, it provides a way of clean degradation.[/color]

        But the javascript href is not in the HTML source code. It is within a
        javascript string literal.
        [color=blue][color=green][color=darkred]
        >>> Exactly the informed/experienced will use the above
        >>> construct to support HTML 3.2 user agents, too,[/color]
        >>
        >> No they won't. The attempt would not result in clean degradation on
        >> unscriptable HTML 3.2 UAs (probably the majority of such browsers)
        >> [...][/color]
        >
        > It would, see above.[/color]

        If you put the javascript href in the HTML rather than the javascript
        you cannot achieve clean degradation.
        [color=blue][color=green][color=darkred]
        >>> i.e. your statement is false.[/color]
        >>
        >> Not as worded.[/color]
        >
        > Of course as worded.[/color]

        This is another example of your stubborn refusal to employ English as a
        means of communication. What exactly do you think was the point of
        including the letters HTML in the wording I used if it was not to draw a
        distinction between types of source code? Your unwillingness to
        co-operate in understanding what is clearly intended is a character flaw
        that will strongly discourage people form talking to you at all.
        [color=blue][color=green]
        >> <snip>[color=darkred]
        >>> The presence of javascript: URIs in source code alone
        >>> cannot be considered an indicator for bad style;[/color]
        >>
        >> HTML source code is specified in my statement.[/color]
        >
        > Writing HTML source code is possible with client-side scripting.[/color]

        I wrote: " ... appear in HTML written by the informed/experienced, ...",
        not *written* by javascript.
        [color=blue]
        > You stated that the above source code "wouldn't appear in HTML
        > written by the informed/experienced" which is obviously false.[/color]

        So are your considering javascript "the informed/experienced" as it is
        doing the writing? (That is one of the problems with insisting on being
        over-literal; it goes both ways, and you are no more capable of writing
        statements in English that are truly unambiguous than anyone else is.)
        [color=blue][color=green][color=darkred]
        >>> that depends on the context.[/color]
        >> <snip>
        >>
        >> The context of providing bookmarkable javascript URIs is
        >> the only reasonable example of there use in HTML [...][/color]
        >
        > No, it is not.[/color]

        If you don't suggest more contexts your argument is no more than your
        usual "I am right and everyone else is wrong", and that is less than
        convincing.

        Richard.


        Comment

        • Thomas 'PointedEars' Lahn

          Re: Top warning signs of bad code?

          Richard Cornford wrote:
          [color=blue]
          > Thomas 'PointedEars' Lahn wrote:[color=green]
          >> Richard Cornford wrote:[color=darkred]
          >>> Thomas 'PointedEars' Lahn wrote:
          >>>> Richard Cornford wrote:
          >>>>> href="javascrip t:somefunction( )" -wouldn't appear in HTML written
          >>>>> by the informed/experienced, so
          >>>>> can be stated as bad.
          >>>> Intrinsic event handler attributes have been introduced in
          >>>> HTML 4.01
          >>> They were not introduced, they were formalised, and in the December
          >>> 1997 draft of HTML 4.0 according to the HTML specs. That does not
          >>> mean that they will be unavailable on HTML 3.2 user agents.[/color]
          >>
          >> The fact that "It is inappropriate to use W3C Working Drafts as
          >> reference material or to cite them as other than 'work in progress'."
          >> aside[1], "HTML 3.2 aims to capture recommended practice as of early
          >> [19]96 [...]"[2] Therefore, it is, on the contrary, highly likely
          >> that HTML 3.2 user agents do not support intrinsic event handler
          >> attributes.[/color]
          >
          > Exactly how many scriptable web browsers existed in early 1996? One?[/color]

          I don't know, I care less and the answer to this question is
          completely unimportant regarding the discussed issue.

          You are but unsuccessfully trying to escape the simple fact that
          you cannot reasonably call something "bad style" if you don't know
          about all the ways it can make sense.
          [color=blue][color=green]
          >> However, code like
          >>
          >> <script type="text/javascript">
          >> document.write(
          >> '<a href="javascrip t:foobar()" onclick="foobar ();'
          >> + ' return false;">foobar< \/a>');
          >> </script>
          >>
          >> is possible and, even more, it provides a way of clean degradation.[/color]
          >
          > But the javascript href is not in the HTML source code. It is within a
          > javascript string literal.[/color]

          That J(ava)Script string literal contains HTML source code,
          and this J(ava)Script source code generates HTML source code.
          [color=blue][color=green][color=darkred]
          >>>> Exactly the informed/experienced will use the above
          >>>> construct to support HTML 3.2 user agents, too,
          >>> No they won't. The attempt would not result in clean degradation on
          >>> unscriptable HTML 3.2 UAs (probably the majority of such browsers)
          >>> [...][/color]
          >> It would, see above.[/color]
          >
          > If you put the javascript href in the HTML rather than the javascript
          > you cannot achieve clean degradation.[/color]

          I write HTML with a javascript: URIs using JavaScript and can achieve
          clean degradation for there are features that can only be accomplished
          with client-side scripting and as such should be written dynamically.


          PointedEars
          --
          Hmmm... Purple!

          Comment

          • Richard Cornford

            Re: Top warning signs of bad code?

            Thomas 'PointedEars' Lahn wrote:[color=blue]
            > Richard Cornford wrote:[color=green]
            >> Thomas 'PointedEars' Lahn wrote:[color=darkred]
            >>> Richard Cornford wrote:
            >>>> Thomas 'PointedEars' Lahn wrote:
            >>>>> Richard Cornford wrote:
            >>>>>>href="jav ascript:somefun ction()" -wouldn't appear in HTML written
            >>>>>> by the informed/experienced, so
            >>>>>> can be stated as bad.
            >>>>> Intrinsic event handler attributes have been introduced in
            >>>>> HTML 4.01
            >>>> They were not introduced, they were formalised, and in the
            >>>> December 1997 draft of HTML 4.0 according to the HTML specs.
            >>>> That does not mean that they will be unavailable on HTML 3.2
            >>>> user agents.[/color][/color][/color]
            <snip>[color=blue][color=green][color=darkred]
            >>> ... Therefore, it is, on the contrary, highly likely that
            >>> HTML 3.2 user agents do not support intrinsic event handler
            >>> attributes.[/color]
            >>
            >> Exactly how many scriptable web browsers existed in early 1996? One?[/color]
            >
            > I don't know, I care less and the answer to this question is
            > completely unimportant regarding the discussed issue.[/color]

            The historical context in which HTML 3.2 was written is very relevant to
            exactly to what extent it would be "highly likely" that scriptable HTML
            3.2 user agents would understand intrinsic events. As JavaScript
            transitioned from beta to 1.0 around the turn of 1996 it is actually
            highly likely that any subsequent HTML 3.2 browsers introduced with
            scripting would have followed the example of Netscape 2 and implemented
            intrinsic events regardless of the then current HTML spec.
            [color=blue]
            > You are but unsuccessfully trying to escape the simple fact that
            > you cannot reasonably call something "bad style" if you don't know
            > about all the ways it can make sense.[/color]

            Who is trying to escape what here? (success or otherwise being best left
            to others to judge.)

            You started off arguing that javascript hrefs were a useful fallback for
            HTML 3.2 user agents because it was "highly likely" that they would not
            understand intrinsic events. That point evaporated when you realised
            that no such browser ever existed. (Assuming that it has now dawned on
            you that that is the case.)
            [color=blue][color=green][color=darkred]
            >>> However, code like
            >>>
            >>> <script type="text/javascript">
            >>> document.write(
            >>> '<a href="javascrip t:foobar()" onclick="foobar ();'
            >>> + ' return false;">foobar< \/a>');
            >>> </script>
            >>>
            >>> is possible and, even more, it provides a way of clean
            >>> degradation.[/color]
            >>
            >> But the javascript href is not in the HTML source code.
            >> It is within a javascript string literal.[/color]
            >
            > That J(ava)Script string literal contains HTML source code,
            > and this J(ava)Script source code generates HTML source code.[/color]
            <snip>

            So the dispute is reduces to nothing more than your refusal to
            comprehend that the wording "appear in HTML" was intended to draw
            precisely this distinction. HTML written by javascript appears in
            javascript source code not HTML. Otherwise there would have been no
            point in my mentioning HTML at all.

            Richard.


            Comment

            Working...