two dropdown menus

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

    #16
    Re: two dropdown menus

    Matt Kruse wrote:[color=blue]
    > Richard Cornford wrote:[color=green]
    >> Two years ago I was
    >> writing scripts much like you write now[/color]
    >
    > (first of all, much of the content of my site is not what I'm writing
    > "now", but has been there for a while... the latest addition was the
    > DHTML tree, which surely follows your design ideals)[/color]

    I had assumed that the in-window pop-up code that you recently posted
    the URL of was contemporary, as your comments and its appalling
    behaviour on Opera 7 gave it the air of a work in progress. I did think
    that not taking the opportunity to define the contents of the pop-ups
    (at least the non-IFRAME ones) in the HTML on the page was retrograde
    after your DHTML tree, but as you have repeatedly express a belief that
    needlessly introducing javascript dependencies has no significance that
    didn't strike me as out of character.

    <snip>[color=blue]
    > Considering that some of my code has been used by smany very major
    > web sites around the world, and my libraries have been useful to
    > literally thousands of web sites and saved the butts of many
    > behind-schedule web developers, I think you're being over-dramatic.[/color]

    As you have decided to raise this weight of numbers/deployed on real web
    sites thing again (when I thought that the reason you did not pursue the
    argument last time was that you had spotted how hollow it was) it is
    probably worth examining its merits.

    The implications of the argument are:-

    1. The act of deploying a script on a web site (and/or the
    fact that it has been chosen by someone for deployment),
    in itself, imbues that script with some additional "worth"
    (value, measure of standard/quality or whatever).

    2. That additional "worth" is proportional to the number of
    instances of the deployment of that script (possibly
    weighted by the size, importance, popularity, profitability,
    or whatever, or the web sites on which it is used).

    It doesn't take much examining of web sites, or knowledge of web site
    development, to realise that there is one clear contender for the most
    widely used scripts; from the smallest web sites to the largest, by at
    least an order of magnitude, the most popular deployed scripts worldwide
    are the javascript functions output by Macromedia Dreamweaver.
    Dreamweaver functions are so popular that you will often see the same
    one defined two or three times on the same page.

    So by this measure of quality MM_findObj, MM_swapImage,
    MM_swapImgResto re and their friends, are the pinnacle of browser
    scripting.

    However, the opinion of the Dreamweaver functions most widely expressed
    on this group is that they are among the worst scripts ever written and
    would be best used to illustrate how not the write javascript. Indeed I
    have only ever seen one comment in favour of the Dreamweaver functions
    and that stressed nothing but how general they are. A characteristic
    that directly results in them being inefficient, which invariably
    features in the list of arguments against them.

    When a measure of "worth" ranks scripts that informed opinion denigrates
    so heavily above all others that criteria cannot be a measurement of
    script quality.

    <snip>[color=blue]
    > So quit the condescending crap. If you were offering up a bunch of
    > solutions for thousands of developers around the world to use and
    > benefit from, and it was always up-to-date and representative of the
    > best coding ideals, then you might be able to criticize.[/color]

    By which you are saying that my opinion has no value unless I adopt your
    approach to javascript authoring and start doing what you have chosen to
    do. But my opinion is that your approach is misguided, so I could not be
    expected to adopt it.

    To only accept criticism about your approach from people who follow your
    approach is one way of disregarding criticism, but it lacks any
    reasonable foundation.
    [color=blue]
    > Offering theory - as you usually do - is much _much_
    > _MUCH_ easier than maintaining a web site of examples,
    > code, support, and documentation.[/color]

    What you see as theory I regard as explanation. I don't see the
    distribution of even the very best generalised javascript libraries as
    the solution to the lamentable current state of Internet browser
    scripting. I perceive promoting an understanding of browser scripting as
    a practice, its issues and javascript as a language as much more likely
    to have a positive impact in that area. Understanding is best promoted
    through explanation.

    If you see an explanation of the possibilities as theory then that is a
    matter of perception. It doesn't matter that you do; theories can be
    refuted if they are wrong, so feel free to refute if you can. Though
    bare in mind that if I really am posting speculative nonsense with no
    hope of implementation then the fact that I am posting it on Usenet
    would normally mean that someone would nave noticed and publicly
    criticised me for it (that is what happens on Usenet, as you must have
    observed given that you have complained about it).
    [color=blue][color=green]
    >> That happens a lot, people who don't know any better lumber
    >> themselves with problems by choosing inappropriate scripts
    >> because those scripts are easy to find.[/color]
    >
    > Would it not make sense for you to then offer "better" solutions
    > so that they can become popular and used everywhere?[/color]

    That wouldn't help much as giving someone who doesn't know what criteria
    to apply to the choice something else to choose from only fractionally
    increases the chances of an appropriate outcome (assuming it is a
    "better" choice). While making them aware of the criteria they should be
    applying to that choice significantly increases their chances of making
    the right one.
    [color=blue]
    > I'm not sure you should be condemning users who offer solutions[/color]

    "Users who offer solutions"? You mean developers?
    [color=blue]
    > (and opening themselves up to criticism) when you aren't
    > prepared to offer any better replacements. Telling the
    > world that they are doing something wrong doesn't carry much
    > weight when you don't supply something better.[/color]

    When public script collection copy-n-paste is so bad, and bloated
    generalised libraries little better, being supplied "something better"
    is a matter of employing someone who knows what they are doing to work
    on a specific problem. I cannot work on everyone's specific problems,
    but I can try to increase the chances that whoever does knows what they
    are doing.
    [color=blue][color=green]
    >> I have told you before, you start off with the OPTIONs defined in
    >> the HTML and you test the dynamism of the browser by trying to
    >> remove them.[/color]
    >
    > a) This will not always work.[/color]

    Whether it will always work isn't practical to judge, but the mere fact
    that the OPTIONs start off in the SELECT elements on the page massively
    increases the chances that they will be available to the user in the
    event of script failure or lack of browser support over any
    implementation that defines the data for the OPTIONs in a javascript
    data structure.
    [color=blue]
    > I would _love_ for you to demonstrate
    > this in a cross-browser way that degrades nicely and
    > doesn't break in any browsers.[/color]

    You found a browser on which the version of mine that you have seen
    didn't display its degraded interface when it failed act dynamically?
    [color=blue]
    > b) The concept of "draw plain html and then go back and make it into
    > fancy dhtml" is good in theory, but not always in reality. I've had a
    > number of users complain that the screen is drawn, then "snaps" into
    > place with a better interface. "Why does the screen jump like that?
    > Can you fix it?". Things like changing a <ul> into a dhtml tree is
    > different, because the same structure is there. The page contents
    > don't change drastically.[/color]

    A browser that tries to render progressively can do that with pure
    HTML/CSS (particularly when float:right|lef t are used). It is a long way
    form being unaddressable.

    <snip>[color=blue][color=green][color=darkred]
    >>> Buggy browsers should not be supported.[/color][/color][/color]
    [color=blue][color=green]
    >> Is there (or has there ever been) a single web browser that does not
    >> have a bug?[/color]
    >
    > No, of course not.[/color]

    So no browser should be supported? (that will cut down the workload :)
    [color=blue]
    > But if you're coding for dynamic select
    > lists, and you know that Opera 5.02 can create Option objects
    > but not add them to select lists, then that's a very specific bug.
    > Users of that browser should see things break, because that's a
    > big problem that cannot be reasonably tested for.
    > In those situations, I think it's better to
    > inform the user that their browser sucks then to change the
    > whole way that a script functions to support the broken browser.[/color]

    From the point of view of a script a browser that does not support a
    particular feature (be it through a bug or otherwise) is not any
    different from a browser that does not support scripting at all. If
    scripts are designed to degrade cleanly then they can cope with any sort
    of failure by doing what they would do on a javascript
    incapable/disabled browser.

    It is not a matter of supporting buggy browsers as such; the script
    cannot do what it was designed to actively do, but it can cleanly
    degrade.

    Are you actually saying that Opera 5.02 will allow OPTIONs to be removed
    from a SELECT element and new Options to be created but it will not
    allow them to be added to a SELECT element? That would be a very
    specific bug, but completely amenable to feature detection.

    Richard.


    Comment

    • Matt Kruse

      #17
      Re: two dropdown menus

      Richard Cornford wrote:[color=blue]
      > I had assumed that the in-window pop-up code that you recently posted
      > the URL of was contemporary[/color]

      I don't recall the URL.
      [color=blue]
      > as your comments and its appalling
      > behaviour on Opera 7 gave it the air of a work in progress.[/color]

      If you're referring to the popup window script, it certainly was a work in
      progress, and the issues with Opera were/are known.
      I've since decided to use a different approach to the whole concept. The
      code was more "test of concept" than anything.
      [color=blue]
      > 1. The act of deploying a script on a web site (and/or the
      > fact that it has been chosen by someone for deployment),
      > in itself, imbues that script with some additional "worth"
      > (value, measure of standard/quality or whatever).[/color]

      It does. Anything that is used successfully by many people has more value
      than a solution used by no one. I suppose that depends entirely on how you
      define 'value'. But to me, getting a job done, meeting requirements, and
      benefitting from work done is a sign of value. The "Pet Rock" surely had no
      value in and of itself. But as soon as millions of people wanted one, it had
      incredible value to those buying it and those profiting from it.
      [color=blue]
      > 2. That additional "worth" is proportional to the number of
      > instances of the deployment of that script (possibly
      > weighted by the size, importance, popularity, profitability,
      > or whatever, or the web sites on which it is used).[/color]

      True again. The more something is used, the more valuable it is to more
      people. Usually.
      [color=blue]
      > So by this measure of quality MM_findObj, MM_swapImage,
      > MM_swapImgResto re and their friends, are the pinnacle of browser
      > scripting.[/color]

      Quality != Value
      The dreamweaver scripts may not be high quality in terms of coding, but they
      certainly have added incredible value for a number of people who simply
      couldn't have done anything dynamic without them.

      A solution does not need to be perfect to have value.

      Go into any consumer market for a quick lesson in this fact. Things don't
      always make sense. People will sometimes prefer lower-quality solutions in
      favor of more convenience, lower price, faster delivery, etc, etc. You are
      implying that a solution which is not technically ideal is always less
      valuable than a solution which follows all the technical ideas. But this
      idea is clearly absurd!

      To a new html author making a web site for their dog, adding image swapping
      with a few clicks of a button is fantastic! Even if it's not technically the
      best solution, they don't care. Even if there are better ways to do it, they
      don't care. Even if it will break in 5% of their visitors' browsers, they
      don't care. Your assumptions about how value is determined does not apply to
      everyone. Even if you think they should.
      [color=blue]
      > When a measure of "worth" ranks scripts that informed opinion
      > denigrates so heavily above all others that criteria cannot be a
      > measurement of script quality.[/color]

      Again, don't confuse value (worth) with quality.
      The most technically-superior solutions are rarely the most popular or
      valuable to most people.
      [color=blue]
      > If you see an explanation of the possibilities as theory then that is
      > a matter of perception. It doesn't matter that you do; theories can be
      > refuted if they are wrong, so feel free to refute if you can.[/color]

      Here you go... your "solutions" are often ugly and unacceptable to some
      people who are writing the checks.
      In your "ideal" world where theories and explanations are all that need be
      discussed, this doesn't matter much to you. But in the real world (which I
      deal with, and which you continually ignore) it's a big factor.
      [color=blue]
      > bare in mind that if I really am posting speculative nonsense with no
      > hope of implementation then the fact that I am posting it on Usenet
      > would normally mean that someone would nave noticed and publicly
      > criticised me for it[/color]

      Not necessarily. Many choose not to express themselves in public. I've
      received emails with varying points of view on our discussions. :)
      I don't take any of this personally (in fact, I think I benefit from having
      ideas challenged and challenging those of others) so it doesn't both me to
      post publicly. But not everyone is like that.
      [color=blue]
      > When public script collection copy-n-paste is so bad, and bloated
      > generalised libraries little better, being supplied "something better"
      > is a matter of employing someone who knows what they are doing to work
      > on a specific problem.[/color]

      In a perfect world, maybe. In the real world, this isn't even always
      possible.
      [color=blue]
      > From the point of view of a script a browser that does not support a
      > particular feature (be it through a bug or otherwise) is not any
      > different from a browser that does not support scripting at all.[/color]

      That is completely untrue.
      Sometimes bugs cannot be found or worked around via feature detection.
      If calling alert() for example would crash browser X, how could you
      possiblly test for that, or have it degrade gracefully for such a browser?
      [color=blue]
      > Are you actually saying that Opera 5.02 will allow OPTIONs to be
      > removed from a SELECT element and new Options to be created but it
      > will not allow them to be added to a SELECT element? That would be a
      > very specific bug, but completely amenable to feature detection.[/color]

      That is exactly what I have observed.
      See this url in Opera 5.02:


      If you can detect that the first and second links will work, but not the
      third, using only feature detection, I would like to see it. I've not come
      up with a good way to test for it, other than actually doing it and seeing
      if it works.

      --
      Matt Kruse
      Javascript Toolbox: http://www.JavascriptToolbox.com/


      Comment

      • Richard Cornford

        #18
        Re: two dropdown menus

        Matt Kruse wrote:[color=blue]
        > Grant Wagner wrote:[/color]
        <snip>[color=blue][color=green]
        >> ... Millions of people world-wide smoke cigarettes too,
        >> it doesn't mean it's a good idea.[/color]
        >
        > That's completely unrelated. And not a hyperbole at all.
        >
        > It's similar to the linux-freaks who bash microsoft on a regular
        > basis, pointing out how badly Windows handles a lot of things. In
        > many cases, they're right. But so what? Millions of people use
        > Windows every day and it fits their needs perfectly and enables them
        > to work better. Just because Windows isn't perfect doesn't mean it
        > has no value, or that its use should be discouraged. Quite the
        > opposite.[/color]

        You are saying - if many use then good - (a theory), Grant is
        observing - bad (NOT good) AND many use -, and deducing - NOT <if many
        use then good> - (as the (empirical) observation refutes the theory).
        You are then representing that as - if many use then bad (NOT good) -
        and/or - if few (NOT many) use then good -. Which are rhetorical
        derivations (a "straw man" argument) not logical ones.
        [color=blue]
        > Similarly, my point is this - if some of my libraries
        > are used by thousands of developers, ...[/color]
        <snip>[color=blue]
        > ... . I'm sure there are countless
        > developers a day who receive the requirement of "there should be a
        > popup calendar to pick a date". You or Richard may say that's a
        > stupid requirement that shouldn't be implemented, but that doesn't
        > change the fact that there are lots of people who WILL implement it
        > because they DO need it.[/color]
        <snip>

        I have no recollection of Grant ever expressing an opinion on pop-up
        calendar date pickers. And I have never said they shouldn't be
        implemented, I actually think they can represent a potentially useful
        enhancement to a browser based GUI (for some users).

        I do think that their design should address a number of issues; starting
        with the normal clean degradation issue. If they represent the only
        means of entering the required information then the result is javascript
        dependent, but if they are implemented to, say, activate when a user
        clicks on a date entry field in a form, and act as a quick alternative
        means of entering that information (appropriately formatted, etc) then
        script failure does not deny the user the possibility of entering the
        required date.

        They are also a very pointing device orientated means of entering a
        date. Which is why I described them as an enhancement for some users
        (the ones using pointing devices as their primary means of interaction
        with the browser; the majority) and why I would only propose activation
        on a mouse click (rather than say onfocus) as that implies the pointing
        device with which the pop-up calendar makes sense. A user who is tabbing
        through a form using the keyboard is probably not going to want to
        switch to the mouse to enter data, and providing clean degradation also
        facilitates direct keyboard data entry into the fall-back HTML field(s).

        Then again, the implementation might attempt to facilitate keyboard
        navigation of the calendar GUI (Web Content Accessibility Guidelines
        1.0 - 'AA' conformance already requires that (6.4, 9.3) and Web Content
        Accessibility Guidelines 2.0 - 'A' conformance looks like it will
        require it (2.1)), but tabbing through 30-odd days in a month is
        probably more work than typing in the date directly (even if split
        across 3 fields).

        There is of course also the reliability issue when 'pop-up' means 'new
        browser window' that results from the use of pop-up blockers, and the
        display issues surrounding the combination of positioned DIV elements
        and form fields that would arise for in-window pop-up implementations .

        But they are all issues that can be addressed (one way or another) in an
        implementation to produce a potentially useful cross-browser enhancement
        to an HTML form.

        Richard.


        Comment

        • Richard Cornford

          #19
          Re: two dropdown menus

          Dr John Stockton wrote:[color=blue]
          > Richard Cornford wrote:
          >[color=green]
          >>It is difficult to judge the scope of the DDA as currently there is
          >>none of the required legal precedents as the cases that have been
          >> brought to ...
          >>And then there is the rest of the world, where any country may have,
          >>or introduce, its own legislation on the subject.[/color]
          >
          > That's all rather legalistic.
          >
          > By DAA, ADA, etc., Governments have formally recognised that those
          > with disabilities should not be disadvantaged where that can
          > reasonably be avoided.
          >
          > But this has been known since Man's ancestors first became near-human;
          > although not always implemented.[/color]
          <snip>

          The moral imperative; the notion that a web developer might also attempt
          to conform with being a decent human being and so not want to take
          otherwise avoidable actions that they knew would have harmful side
          effects for the already disadvantaged.

          But can you cite a specification on that? ;-)

          Though it can be avoided through ignorance/unawareness/denial,
          attributing responsibility to others, and appeals to Mammon.

          Richard.


          Comment

          • Richard Cornford

            #20
            Re: two dropdown menus

            Matt Kruse wrote:[color=blue]
            > Richard Cornford wrote:[/color]
            <snip>[color=blue][color=green]
            >> 1. The act of deploying a script ...[/color][/color]
            <snip>[color=blue]
            > It does. ...[/color]
            <snip>[color=blue][color=green]
            >> 2. That additional "worth" is proportional to ...[/color][/color]
            <snip>[color=blue]
            > True again. ...[/color]
            <snip>[color=blue]
            > Quality != Value[/color]
            [color=blue]
            > The dreamweaver scripts may not be high quality in terms of coding,
            > but they certainly have added incredible value for a number of people
            > who simply couldn't have done anything dynamic without them.
            >
            > A solution does not need to be perfect to have value.[/color]

            The Dreamweaver functions aren't not perfect, they are bad. They
            represent almost the worst way of doing everything they attempt and the
            only justification for that is that they were designed to be used by a
            machine without the application of any knowledge on its part and in
            response to nothing other than user actions.
            [color=blue]
            > Go into any consumer market for a quick lesson in this fact. Things
            > don't always make sense. People will sometimes prefer lower-quality
            > solutions in favor of more convenience, lower price, faster delivery,
            > etc, etc. You are implying that a solution which is not technically
            > ideal is always less valuable than a solution which follows all the
            > technical ideas. But this idea is clearly absurd![/color]

            That is not what I am implying. I am implying (saying) that your
            criteria of "value" is utterly bogus. It promotes the bad over the good,
            the dependent over the reliable, the ill-conceived over the well
            designed and the status quo over the possibility of improvement.

            Though by any rational criteria software that is technically ideal is
            better than software that is not. Why did you even contemplate arguing
            otherwise? If you achieve the ideal what you have is something good, by
            virtue of the definition of the terms. The criteria in that case is
            quality, and may be judged on nothing more than the software itself. But
            identifying an ideal doesn't necessitate that all software achieve it
            prior to use, that would be unrealistic. But it does provide a target to
            aim for and a criteria to assess the results of the attempt to reach it.

            If someone designs and implements with the goal of achieving perfection
            there is actually a chance that they may reach it (sooner or later, and
            achieve ever better quality software along the way), but if their goal
            is your criteria of "value" what is the most they can hoped for;
            MM_findObj?
            [color=blue]
            > To a new html author making a web site for their dog, adding image
            > swapping with a few clicks of a button is fantastic! Even if it's not
            > technically the best solution, they don't care. Even if there are
            > better ways to do it, they don't care. Even if it will break in 5% of
            > their visitors' browsers, they don't care. Your assumptions about how
            > value is determined does not apply to everyone. Even if you think
            > they should.[/color]

            Amateurs can do what they like, if they never learn to do anything well
            they won't have much influence on the wider word for good or ill.
            Amateurs can choose what standards they wish to work to, maybe high
            standards if they like the challenge, maybe low standards if they are
            primarily interested in other things, or maybe something in between.

            But professionals have responsibilitie s. You wouldn't think much of a
            doctor who chose a treatment because it was popular, convenient, quick
            and cheep, but failed 5% of the time, over a treatment that was reliable
            and effective. Web development might not be life and death but is that
            really an excuse for professional ethics so lax that they rate
            convenience so far above quality?
            [color=blue][color=green]
            >> When a measure of "worth" ranks scripts that informed opinion
            >> denigrates so heavily above all others that criteria cannot be a
            >> measurement of script quality.[/color]
            >
            > Again, don't confuse value (worth) with quality.
            > The most technically-superior solutions are rarely the most popular or
            > valuable to most people.[/color]

            Self evidently.

            <snip>[color=blue]
            > Here you go... your "solutions" are often ugly[/color]

            Mine personally?
            [color=blue]
            > and unacceptable to some people who are writing the checks.
            > In your "ideal" world where theories and explanations are all that
            > need be discussed, this doesn't matter much to you. But in the real
            > world (which I deal with, and which you continually ignore) it's a
            > big factor.[/color]

            You attribute ugliness and then suggest that ugliness will be unpopular
            with clients. But on the javascript and CSS capable/enabled and
            sufficiently supportive browsers a functional script that is capable of
            cleanly degrading does not have to have any appearance characteristics
            that are not identical to a javascript dependent script implementing
            identical functionality. The difference comes when the browser does not
            supports either script, and the javascript dependent version starts
            denying the possibility of user interaction and any consequential
            purchases, turnover, profits etc. While the cleanly degrading script is
            facilitating continued user interaction, but at the cost of some aspects
            of presentation and user convenience, that the user will not notice
            because that is how they normally experience the Internet (when it works
            for them at all).

            You are telling me that hard-nosed businessmen are going to prefer a
            site that doesn't look quite as designed but brings in money over a site
            that looks pretty but is not functional, for a minority of users of
            unusual browsers? These are certainly not the businessmen in my world.
            My money would be on them actually choosing the version that continues
            to bring in the money, if they had been properly informed of the
            situation.

            <snip>[color=blue][color=green]
            >> From the point of view of a script a browser that does not support a
            >> particular feature (be it through a bug or otherwise) is not any
            >> different from a browser that does not support scripting at all.[/color]
            >
            > That is completely untrue.
            > Sometimes bugs cannot be found or worked around via feature detection.[/color]

            You keep saying that, but never get round to proposing any concrete
            examples and I suspect that many of the things that you believe are
            untestable (see below) would prove amenable to feature detection, or
            their use unnecessary.
            [color=blue]
            > If calling alert() for example would crash browser X, how could you
            > possiblly test for that,[/color]

            Are you aware of a browser that crashes when you call - alert -? That
            would be serious evidence of a reckless failure to test on the part of
            the browser's manufacturer. However, I do get round the fact that merely
            reading the - appendChild - property from an attribute object on many IE
            6 versions will crash the browser, by not reading the - appendChild -
            property of attribute objects (as there is absolutely no need or point).
            And I also promote the use of an element's - setAttribute - and -
            getAttribute - methods over any direct interaction with the attribute
            objects, as they do all that is necessary, can be safely detected and
            have not been reported as causing any problems on any supporting browser
            to date.
            [color=blue][color=green]
            >> Are you actually saying that Opera 5.02 will allow OPTIONs to be
            >> removed from a SELECT element and new Options to be created but it
            >> will not allow them to be added to a SELECT element? That would be a
            >> very specific bug, but completely amenable to feature detection.[/color]
            >
            > That is exactly what I have observed.
            > See this url in Opera 5.02:
            > http://www.mattkruse.com/temp/opera_options_test.html
            >
            > If you can detect that the first and second links will work, but not
            > the third, using only feature detection, I would like to see it.[/color]

            Unnecessary, Opera 5.02 is capable of adding OPTION elements to the
            options collection of a SELECT element. You had misattributed the cause
            of the failure to the ability to add the element, it is actually due to
            the fact that opera 5.02 does not implement the - length - property on
            the - options - collection so:-

            f.test.options[f.test.options. length] = o;

            - is adding a property with the name "undefined" to the options
            collection, and that does not represent a meaningful action to the
            browser. The - length - property of the SELECT element itself is numeric
            and reporting the actual length of the options collection, so it may be
            used instead. But I don't think it is worth the effort for one release
            of such an old browser if a path of clean degradation exists for any
            residual users of that browser.

            How much time have you put into failing to identify that problem? The
            first thing I did was put in:-

            alert(f.test.op tions.length);

            - and I immediately knew exactly what was going on. My next test,
            changing your original line above to:-

            f.test.options[f.test.length] = o;

            - confirmed my suspicion and presented a possible solution.

            (A first principle of feature detection is to test as near to the
            problem as possible.)

            My dependent select script, for all its shortcomings, still degraded
            successfully to the underlying HTML on Opera 5.02 as designed, because
            one of the earliest feature detection tests it does is to verify that
            the length property of an - options - collection conforms to its
            requirements. Undefined does not conform so the script cleanly degrades
            under its own control.

            As I had to download Opera 5.02 specifically to test your page (the
            oldest Opera version I had was 5.12), tying my script with it
            represented its first exposure to a new and clearly buggy environment.
            And the fact that it behaved exactly as designed in the face of that
            environment rather demonstrates that the theory (as you would have it)
            about how to script for reliability in the face of unknown browser
            environments is a little more practical that you would like to think it.
            [color=blue]
            > I've not come up with a good way to test for it,[/color]

            if(typeof f.test.options. length == 'number'){
            // pass
            }else{
            // fail
            }

            - would do.
            [color=blue]
            > other than actually doing
            > it and seeing if it works.[/color]

            Actually adding elements (or, as I have said, preferably removing them)
            and seeing if it worked is probably the only way of verifying that the
            browser's DOM is sufficiently dynamic to actively support the script.

            Richard.


            Comment

            • Matt Kruse

              #21
              Re: two dropdown menus

              Richard Cornford wrote:[color=blue]
              > I am implying (saying) that your
              > criteria of "value" is utterly bogus. It promotes the bad over the
              > good, the dependent over the reliable, the ill-conceived over the well
              > designed and the status quo over the possibility of improvement.[/color]

              "Value" is decided by each individual person, and by extension the general
              public. For some people, the ability to implement functionality in 10
              minutes yet have it break in 2% of browsers might have higher value than a
              custom-built solution that doesn't break in any bowser but takes 8 hours to
              code and test. For a flashy personal fun site, the deciding factor for
              "value" might be a really slick interface with lots of options, and quality
              of code and browser support might not be important at all.

              In terms of javascript coding, I can think of a number of factors which
              would contribute to a person's perception of 'value' for a given solution:
              - Ease of implementation
              - Browser support (including how well it degrades)
              - Extensibility
              - Available features
              - Price/licensing/restrictions
              - Support
              - Quality of coding (and by extension, ease of maintenance)
              - Speed

              In your eyes, quality of coding and degrading gracefully are the most
              important factors, above all else, right? A solution cannot have high value
              without those being top-notch?

              But to others, the important factors might be different. The determination
              of 'value' can vary greatly. In fact, you place almost no importance on
              'ease of implementation' or 'available features' (since you disagree with
              the concept of libraries entirely), which others might put at the top of the
              list. I argue that my solutions provide higher value to some people because
              we are targeting different factors as priorities.

              In an ideal world, a solution could provide all of the above. Except maybe
              price, because to create such a solution for free is not something most
              people would do :) (although, I'd argue that I come closer than most ;)
              [color=blue]
              > Though by any rational criteria software that is technically ideal is
              > better than software that is not. Why did you even contemplate arguing
              > otherwise?[/color]

              Because I believe you are wrong.
              Technically, I think linux is better than Windows as an OS.
              However, I use Windows daily because it provides more value to me. It's
              "better" for me. Even though I don't believe it's technically superior.
              I can think of many other such examples that I encounter on a daily basis.
              Is that something you find hard to understand?
              [color=blue]
              > Web development might not be life and death
              > but is that really an excuse for professional ethics so lax that they
              > rate convenience so far above quality?[/color]

              heh, that is _everywhere_ in the world. How many people use Windows with
              bugs and viruses and broken features, because it is more convenient than
              more technically superior solutions? How many web developers receive
              requests for features every day that are technically stupid, but must be
              implemented because it adds convenience for the users? That's the way of
              life for most software developers :)
              [color=blue][color=green]
              >> Here you go... your "solutions" are often ugly[/color]
              > Mine personally?[/color]

              Yes...
              Your date picker script on your example page would be unacceptable to most
              clients I've worked with because of the UI.
              You dynamic select list script degrades nicely, but in a form that would be
              unacceptable to most.
              IMO.
              [color=blue]
              > You are telling me that hard-nosed businessmen are going to prefer a
              > site that doesn't look quite as designed but brings in money over a
              > site that looks pretty but is not functional, for a minority of users
              > of unusual browsers?[/color]

              Perhaps. I've seen it happen. Repeatedly. Have you not?
              [color=blue]
              > However, I do get round the fact that
              > merely reading the - appendChild - property from an attribute object
              > on many IE 6 versions will crash the browser, by not reading the -
              > appendChild - property of attribute objects[/color]

              So you're not doing feature detection, but rather not using a feature
              entirely. Logical, of course, but it's still an example of a bug which
              cannot be detected through normal means.
              [color=blue]
              > actually due to the fact that opera 5.02 does not implement the -
              > length - property on the - options - collection so:-[/color]

              Hmm, that is indeed interesting, and not something I had even considered
              testing, since it's such a basic feature. Well done.
              [color=blue]
              > How much time have you put into failing to identify that problem?[/color]

              About 2 minutes, way back when I detected the problem. I didn't really try
              to debug it, because I didn't care about supporting 5.02. I was left with
              the (apparently incorrect) assumption that Opera5.02 wouldn't allow adding
              new options to select lists. Some googling at the time confirmed my
              suspicions, so I stopped. In fact, the first result in a search I just did
              was http://www.quirksmode.org/js/options.html which states "You cannot
              create or delete options in Operate 5.02- on Windows". I guess I wasn't the
              only one to reach such a conclusion :)

              At the end of the day, it's pretty clear that we have different ideas about
              javascript development. I think libraries are fantastic, and have a lot of
              value for many developers. You disagree. I think your code is clearly
              advanced and looks technically excellent, but I also think some of it is
              completely unreadable for most people (date picker code, for example). You
              believe in being technically excellent first, and useable second. I believe
              in the opposite.

              Although you disagree with some of my approaches to development, I do
              continue to develop better skills - as does anyone. I strive to offer the
              most technically excellent solutions that I'm capable of, and I'm always
              rethinking my ideas trying to come up with something better. It's a shame
              that someone like you who is technically talented in coding isn't willing to
              make implementation suggestions for scripts like mine, which are highly
              useable, have a lot of features, can be easily implemented, are well
              supported, and work in the way that many developers want them to. No one is
              capable of creating the most ideal solution by themselves, IMO. Multiple
              people working together to create the best possible solutions would be
              fantastic.

              In fact, I've long wanted to create a group of javascript developers who
              work together to create the best functions, modules, and libraries to
              perform various tasks. Some of that is in the FAQ now, but there are many
              other common tasks which could be implemented and made available for every
              javascript developer to learn from and use. Perhaps it's an idea that could
              get started by regulars of this group.

              --
              Matt Kruse
              Javascript Toolbox: http://www.JavascriptToolbox.com/


              Comment

              • Randy Webb

                #22
                Re: two dropdown menus

                Matt Kruse wrote:

                <--snip-->
                [color=blue]
                > In fact, I've long wanted to create a group of javascript developers who
                > work together to create the best functions, modules, and libraries to
                > perform various tasks. Some of that is in the FAQ now, but there are many
                > other common tasks which could be implemented and made available for every
                > javascript developer to learn from and use. Perhaps it's an idea that could
                > get started by regulars of this group.[/color]

                Where do you want to start out? It sounds interesting...


                --
                Randy
                Chance Favors The Prepared Mind
                comp.lang.javas cript FAQ - http://jibbering.com/faq/

                Comment

                • Matt Kruse

                  #23
                  Re: two dropdown menus

                  Randy Webb wrote:[color=blue]
                  > Where do you want to start out? It sounds interesting...[/color]

                  I'd volunteer to create a mailing list.
                  Also, I'm creating a site and content for the URL in my sig (redirecting to
                  my personal site for now), and I think it would be a logical place to house
                  such a project. My plan for now is to put my stuff up there, but I would
                  certainly dedicate a portion of the site (if not the majority of it, and the
                  site's emphasis) to housing the collaborative efforts of a group of
                  javascript experts.

                  I envision a site which accomodates a number of different approaches to
                  script development. I like libraries which deliver a lot of different
                  functionality to end-users (developers) and are relatively easy to
                  implement. Others don't like this approach. But these libraries are
                  dependent on blocks of common functions, glued together to serve a purpose.
                  So others can stop at that level, and just build functions which perform
                  very specific tasks, but offer no functionality on their own. Even those
                  functions are dependent on low-level coding structures which can be made
                  very efficient. For the people who enjoy tighter loops and super-efficient
                  code, they can focus on streamlining the common functions.

                  I believe in doing something productive immediately, and getting immediate
                  results to get going. If things like this get bogged down in planning and
                  fighting over theories and ideals, they fail.

                  I would love to see a plan something like this:
                  1) Create a separate mailing list to communicate.
                  2) Get a core group of knowledgeable and experienced people on the list
                  3) Decide on some very basic assumptions and requirements for all code,
                  or at least an approach to separating solutions which offer similar
                  functionality but with different assumptions/requirements.
                  4) Build low-level functions for common functions which many
                  higher-level scripts are dependent on.
                  5) Create test cases for each function/snippet for future browser
                  testing of the core functionality
                  6) Publish the content as it gets completed for immediate peer review,
                  further testing, and use in real projects

                  Of course, this would rely on a number of talented people coming together,
                  cooperating, and putting egos aside. I think that's the biggest stumbling
                  block ;)

                  --
                  Matt Kruse
                  Javascript Toolbox: http://www.JavascriptToolbox.com/


                  Comment

                  • Richard Cornford

                    #24
                    Re: two dropdown menus

                    Matt Kruse wrote:[color=blue]
                    > Richard Cornford wrote:[color=green]
                    >> I am implying (saying) that your
                    >> criteria of "value" is utterly bogus. It promotes the bad over the
                    >> good, the dependent over the reliable, the ill-conceived over the
                    >> well designed and the status quo over the possibility of improvement.[/color]
                    >
                    > "Value" is decided by each individual person,[/color]

                    It certainly can be, but without (at least some) common criteria there
                    is not much point in those people trying to talk to each other about
                    "value". Yesterday "value" was proportional to instances of script
                    deployment, I don't agree but at least that is concrete enough to be the
                    subject of rational consideration. Today it is entirely a matter of
                    individual opinion.
                    [color=blue]
                    > and by extension the general public.[/color]

                    The general public (even just the Internet using portion of the general
                    public) are unlikely to have any well formed attitude towards browser
                    scripting. The majority will be totally unaware of browser scripting as
                    a distinct aspect of a web page/site, and script design should aim to
                    keep the role of scripting in a web page/site transparent to users.
                    [color=blue]
                    > For some people, the ability to implement
                    > functionality in 10 minutes yet have it break in 2% of browsers[/color]

                    You do love stating numbers without any apparent relationship to
                    anything.
                    [color=blue]
                    > might
                    > have higher value than a custom-built solution that doesn't break in
                    > any bowser but takes 8 hours to code and test. For a flashy personal
                    > fun site, the deciding factor for "value" might be a really slick
                    > interface with lots of options, and quality of code and browser
                    > support might not be important at all.[/color]

                    If it is an informed decision appropriate to the context then that is
                    fine. Though when extremely questionable statistics start appearing in
                    the criteria you have to wonder how informed the decision could be.
                    [color=blue]
                    > In terms of javascript coding, I can think of a number of factors
                    > which would contribute to a person's perception of 'value' for a
                    > given solution:[/color]

                    From the list you appear to be looking upon this person exclusively as a
                    potential purchaser (acquirer) of pre-existing browser scripts. Rather
                    than, say, the commissioner of browser scripts for a particular task, or
                    the project manager of a team, including javascript authors, creating
                    commercial web applications in a software house, or any of the many
                    other people who might have a reason for weighting these and other
                    factors.
                    [color=blue]
                    > - Ease of implementation[/color]

                    Implementation is a relatively vague term when used in this context. It
                    is common to talk of implementing a specification, but ease of
                    implementation in that context is a quality of the specification not of
                    the script that will be implemented from it. Ease of implementation
                    might also be a quality of a design, existing prior to any script that
                    represents the implementation.

                    Given the previous discussion I assume you mean ease of deployment,
                    employment or use in a web page/site. The ease of that is related to
                    various factors including the quality of the documentation (which is
                    independent of the script) and who is doing it.

                    The author of a script would usually find it trivial to deploy without
                    any documentation at all, while a complete newcomer might struggle even
                    with comprehensive and well-written documentation and a script designed
                    to be easy to deploy. Then there is quite a spectrum in between where
                    different factors contribute to ease of deployment/use, and factors
                    contributing to the significance of the javascript code to its ease of
                    deployment.

                    Take deployment through JSP tag libraries, for example, It would be
                    quite feasible to use a script implementation that was objectively
                    complex to set-up and initialise within a tag library because that task
                    would be done once by the specialist who created the tag library code.
                    All of the details would be completely concealed from whoever was
                    eventually using that tag library, allowing easy deployment of that
                    script by people who would be incapable of using actual javascript code
                    independently. But a script written with the intention that it be used
                    directly by those same people would do well to be as simple as a JSP tag
                    to employ.

                    So in the case of the code inside the tag library, effort put into
                    making the javascript easy to set-up and initialise has little reward as
                    it is only occasionally done, no matter how many times the corresponding
                    tags are used. That effort would be better directed at making the script
                    as well suited to its use within a tag library as possible. While effort
                    put in to reduce the set-up and initialisation complexity of the script
                    for direct deployment is very significant because that would be done
                    repeatedly, and by people who would not normally be expected to have
                    more than a minimal understanding of javascript.
                    [color=blue]
                    > - Browser support (including how well it degrades)
                    > - Extensibility[/color]

                    I am not sure extensibility should be in here at all. It speaks of your
                    library mentality, where you want to be adding ever more and more
                    features. But that produces the code bloat problem that is one of the
                    main arguments against libraries as a concept in browser scripting.

                    Modularity should probably take the place of extensibility in this list.
                    Small, direct, re-usable components so that they can be mixed and
                    matched to suite the application.
                    [color=blue]
                    > - Available features[/color]

                    The availability of features doesn't mean much if you don't intend using
                    them. Beyond the need for a script to have all of the features that are
                    wanted/needed (specified), features that are not used are just code
                    bloat (and maybe higher memory/resource consumption, slower execution
                    and download, etc.).
                    [color=blue]
                    > - Price/licensing/restrictions[/color]

                    Price (or cost) certainly. Licensing and licensing restrictions are
                    closely related to the purchasing (acquiring) of software products.
                    Browser scripts themselves are not necessarily software products, they
                    may be, for example, created in-house and used as part of, say, a web
                    application product. They would still have an absolute cost (in
                    developer hours), and knock-on cost implications resulting from their
                    design. But licensing would not be a issue at all.
                    [color=blue]
                    > - Support[/color]

                    Again very much related to the extent to which a browser script is
                    itself seen as the product.
                    [color=blue]
                    > - Quality of coding (and by extension, ease of maintenance)
                    > - Speed[/color]

                    Speed of execution, speed of download, creation deadlines. A DHTML
                    animating script needs to be fast (generally), while form validation
                    execution speed probably doesn't matter at all (unless it is really
                    bad).
                    [color=blue]
                    > In your eyes, quality of coding and degrading gracefully are
                    > the most important factors, above all else, right?[/color]

                    I have never said this. I have said that quality is an absolute
                    characteristic of code and so can be used in objectively comparing code
                    (rather than your rather flexible criteria of "value"), and I have said
                    that quality is more likely to be achieved by attempting to achieve it.

                    What I do consider more important than (almost) anything else is design.
                    Design that is appropriate for the application, specification and the
                    context, design that encompasses established software design principles,
                    applies recognised applicable best practices, facilitates effective
                    testing and eases implementation (and to some extent documentation).

                    The stress that I place on graceful degradation follows from the
                    realisation that it is necessitated in a script intended for use in a
                    web browser in an Internet context.

                    Much as the author of a web application that is to operate over HTTP
                    needs to recognise that HTTP has characteristics that need to understood
                    and handled at the design stage of that application, the author of an
                    Internet browser script needs to recognise that browsers also have
                    characteristics that need to be handled at the design stage. One of
                    those characteristics is that client-side scripting is optional, another
                    is that it is unreliable when it is available. Failing to recognise
                    those (and other) facts, and handle them, is failing to design/author an
                    Internet browser script.

                    Graceful degradation is nothing but one of a number of design
                    prerequisites in scripts intended to be used in web browsers over the
                    Internet.

                    Designing for another context, say an Intranet, where client-side
                    scripting is not optional (because someone has decided that it is not)
                    and scripting is not unreliable (because only a finite set of browsers
                    are intended to be used) removes those factors from the list of
                    prerequisites. The result of such a design will not be a script suited
                    for use in an Internet browser context.

                    Clean degradation offers the only practical way of handling the optional
                    client-side scripting and the variation in DOMs that results in
                    unreliability in scripts, and it is best handled at the design stage as
                    attempting to bolt it on afterwards impacts significantly on many other
                    significant aspects of any script (ease of deployment being a pertinent
                    example).

                    A combination of good design and skilled implementation will tend to
                    result in a quality script, but a combination of appropriate design and
                    knowledgeable implementation should be enough to produce a reliable and
                    functional script.
                    [color=blue]
                    > A solution cannot have high
                    > value without those being top-notch?[/color]

                    We are getting further away from any definition of "value" as time goes
                    by.
                    [color=blue]
                    > But to others, the important factors might be different. The
                    > determination of 'value' can vary greatly.[/color]

                    See what I mean?
                    [color=blue]
                    > In fact, you place almost
                    > no importance on 'ease of implementation'[/color]

                    That isn't what the archives would show (assuming we are actually
                    talking about ease of deployment again), I have actually written quite a
                    lot on designing for easy deployment. It should be a factor in a design.
                    Its significance is specific to the expected circumstances of
                    deployment.
                    [color=blue]
                    > or 'available features'
                    > (since you disagree with the concept of libraries entirely), which
                    > others might put at the top of the list.[/color]

                    As I said, features beyond what is needed (or specified) are potentially
                    negative.
                    [color=blue]
                    > I argue that my solutions
                    > provide higher value to some people because we are targeting
                    > different factors as priorities.[/color]

                    All else aside, you promote scripts you have designed without clean
                    degradation as Internet browser scripts, and then come up with spurious
                    justifications for not considering normal browser characteristics in
                    your design. I am just not going to see that as good (or even
                    appropriate) design, and targeting them at people who don't know enough
                    to recognise the consequences, or making them easy to deploy for those
                    people, is not going to change that.

                    <snip>[color=blue][color=green]
                    >> Though by any rational criteria software that is technically ideal is
                    >> better than software that is not. Why did you even contemplate
                    >> arguing otherwise?[/color]
                    >
                    > Because I believe you are wrong.
                    > Technically, I think linux is better than Windows as an OS.
                    > However, I use Windows daily because it provides more value to me.
                    > It's "better" for me. Even though I don't believe it's technically
                    > superior.[/color]

                    If you make a judgement on technical criteria then technical superiority
                    relates to "better", if you choose other criteria then they rank
                    "better". You chose "not technically ideal" and "follows all the
                    technical ideas" as the characteristics for comparison, which look like
                    technical criteria to me (nothing else is implied about the hypothetical
                    scripts under discussion).

                    <snip>[color=blue][color=green]
                    >> Web development might not be life and death
                    >> but is that really an excuse for professional ethics so
                    >> lax that they rate convenience so far above quality?[/color]
                    >
                    > heh, that is _everywhere_ in the world. How many people use Windows
                    > with bugs and viruses and broken features, because it is more
                    > convenient than more technically superior solutions?[/color]

                    WTF has that got to do with anything? We are talking about people who
                    purport to be professionals providing professional services to clients.
                    The question would be whether a professional should be
                    recommending/supplying software to a client because it was convenient
                    for them. An ethical professional should be doing what they thought was
                    best for their client. There are many valid reasons why that actually
                    may result in recommending a Windows OS over another. But they would
                    relate to the circumstances of the client not the convenience of the
                    "profession al".
                    [color=blue]
                    > How many web
                    > developers receive requests for features every day that are
                    > technically stupid, but must be implemented because it adds
                    > convenience for the users?[/color]

                    How do "technicall y stupid" and "adds convenience for users" get to
                    appear together in the same sentence? If something is technically stupid
                    it stands a very good chance of inconveniencing users. Or are you using
                    "users" to refer to someone other than the person sitting in front of
                    the browser again?

                    <snip>[color=blue]
                    > Your date picker script on your example page would be unacceptable to
                    > most clients I've worked with because of the UI.[/color]

                    Specifically?
                    [color=blue]
                    > You dynamic select list script degrades nicely, but in a form that
                    > would be unacceptable to most.[/color]

                    Isn't that what I have been saying from the outset; that the dependent
                    select list concept has the potential for clean degradation but the
                    degraded state is unsatisfactory as a user interface? Making a fully
                    server-side approach the easiest way of achieving the combination of
                    reliability and functionality in a task that is a fairly common
                    requirement, but usually pre-supposes the availability of server-side
                    scripting.

                    But in circumstances where my UI is being unsatisfactory yours is
                    non-functional.
                    [color=blue][color=green]
                    >> You are telling me that hard-nosed businessmen are going to prefer a[/color][/color]
                    ^
                    There should have been a "not" in there.
                    [color=blue][color=green]
                    >> site that doesn't look quite as designed but brings in money over a
                    >> site that looks pretty but is not functional, for a minority of users
                    >> of unusual browsers?[/color]
                    >
                    > Perhaps. I've seen it happen. Repeatedly. Have you not?[/color]

                    I am yet to meet a businessman (or woman) who would turn down the
                    opportunity to make money when all else was equal.
                    [color=blue][color=green]
                    >> However, I do get round the fact that
                    >> merely reading the - appendChild - property from an attribute object
                    >> on many IE 6 versions will crash the browser, by not reading the -
                    >> appendChild - property of attribute objects[/color]
                    >
                    > So you're not doing feature detection, but rather not using a feature
                    > entirely. Logical, of course, but it's still an example of a bug which
                    > cannot be detected through normal means.[/color]

                    One example from a browser that will build 10,000-odd objects for an
                    average web page, allow their error free use and facilitate feature
                    detection on all the rest of them and their properties. Appending child
                    nodes to attribute objects is something that does not need to be done at
                    all, so it is not a big deal to not be attempting it.

                    Feature detecting is not diminished in its practicality by locating one
                    or two fatal problems in arias of the DOM you would not normally be
                    going into.

                    Feature detection has grown out of a need that no other strategy came
                    close to satisfying. It is practical, it is implementable and it works.
                    And much as your assertions that it would be of no use in the case of
                    Opera 5.02 proved pessimistic, once you become familiar with the
                    techniques and the proper application of the strategy you will find that
                    it can handle everything you are likely to throw at it. (And it isn't as
                    if there is any contender as a viable alternative, short of the
                    acceptance of unreliability and uncontrolled failure.)

                    <snip>[color=blue]
                    > ... . In fact, the first
                    > result in a search I just did was
                    > http://www.quirksmode.org/js/options.html which states "You cannot
                    > create or delete options in Operate 5.02- on Windows". I guess I
                    > wasn't the only one to reach such a conclusion :)[/color]

                    Jim wants me to put a link to quirksmode.org in the resources section of
                    the FAQ. I probably will but I am not so sure it is a good idea. Finding
                    them peddling old wives tails doesn't help.
                    [color=blue]
                    > At the end of the day, it's pretty clear that we have different
                    > ideas about javascript development. I think libraries are
                    > fantastic, and have a lot of value for many developers.
                    > You disagree.[/color]

                    And I didn't turn out to be alone in that opinion did I?
                    [color=blue]
                    > I think your
                    > code is clearly advanced and looks technically excellent, but I also
                    > think some of it is completely unreadable for most people (date
                    > picker code, for example).[/color]

                    The date picker code is not exactly formatted for being read. The
                    commented development version would be easier to understand, but it is
                    too big a script to be practical to document as an example for learning
                    purposes.
                    [color=blue]
                    > You believe in being technically excellent
                    > first, and useable second. I believe in the opposite.[/color]

                    Do you have any specific reasons for attributing that belief to me?

                    <snip>[color=blue]
                    > It's a shame that someone like you who is technically talented in
                    > coding isn't willing to make implementation suggestions for scripts
                    > like mine, which are highly useable, have a lot of features, can be
                    > easily implemented, are well supported, and work in the way that many
                    > developers want them to.[/color]

                    I have made suggestions; I suggested you design was fundamentally
                    ill-suited to the environment of its application. You don't believe me
                    so there is not a great deal more I can do.
                    [color=blue]
                    > No one is capable of creating the most ideal solution
                    > by themselves, IMO. Multiple people working together to
                    > create the best possible solutions would be fantastic.[/color]
                    <snip>

                    My experience of problem solving says: stage 1. Identify the problem.
                    And uses that to define what would qualify as a solution.

                    Richard.


                    Comment

                    • Matt Kruse

                      #25
                      Re: two dropdown menus

                      Richard Cornford wrote:[color=blue]
                      > Take deployment through JSP tag libraries, for example, It would be
                      > quite feasible to use a script implementation that was objectively
                      > complex to set-up and initialise within a tag library because that
                      > task would be done once by the specialist who created the tag library
                      > code.[/color]

                      In fact, I've done exactly this. Nothing polished yet, but you can see my
                      playing around here:


                      It is my goal to have most of my scripts packaged into jsp taglibs (some
                      most likely tied to struts, which is what I work with on a daily basis). It
                      works great. It just takes _more_ time, of which I don't have enough...
                      [color=blue]
                      > How do "technicall y stupid" and "adds convenience for users" get to
                      > appear together in the same sentence?[/color]

                      I typed them both without a [.!?] between them.
                      [color=blue][color=green]
                      >> Your date picker script on your example page would be unacceptable to
                      >> most clients I've worked with because of the UI.[/color]
                      > Specifically?[/color]

                      It's unlike the interface many users are used to, and it covers up the input
                      field. It also activates whether the user wants it to or not. Annoying for
                      keyboard-users who happen to have a capable browser.
                      [color=blue]
                      > Jim wants me to put a link to quirksmode.org in the resources section
                      > of the FAQ. I probably will but I am not so sure it is a good idea.
                      > Finding them peddling old wives tails doesn't help.[/color]

                      Rather, I'd say that others came to the same erroneous conclusion I did,
                      based on not testing assumptions we assumed would always be true (that the
                      options collection would have a length). Testing for the obvious could add a
                      lot of bloat to scripts.
                      [color=blue][color=green]
                      >> At the end of the day, it's pretty clear that we have different
                      >> ideas about javascript development. I think libraries are
                      >> fantastic, and have a lot of value for many developers.
                      >> You disagree.[/color]
                      > And I didn't turn out to be alone in that opinion did I?[/color]

                      Nor am I alone in my opinion.
                      [color=blue]
                      > The date picker code is not exactly formatted for being read.[/color]

                      s/formatted/coded/
                      [color=blue][color=green]
                      >> You believe in being technically excellent
                      >> first, and useable second. I believe in the opposite.[/color]
                      > Do you have any specific reasons for attributing that belief to me?[/color]

                      Magical powers of observation.
                      [color=blue]
                      > I have made suggestions; I suggested you design was fundamentally
                      > ill-suited to the environment of its application. You don't believe me
                      > so there is not a great deal more I can do.[/color]

                      My libraries are made up of a lot of smaller functions which perform
                      specific tasks.
                      Even if you disagree with combining the functions into libraries, individual
                      functions could be critiqued for their ability to perform the specific task
                      for which they were written.
                      [color=blue][color=green]
                      >> No one is capable of creating the most ideal solution
                      >> by themselves, IMO. Multiple people working together to
                      >> create the best possible solutions would be fantastic.[/color]
                      > My experience of problem solving says: stage 1. Identify the problem.
                      > And uses that to define what would qualify as a solution.[/color]

                      I have no idea how that relates to what I said.

                      --
                      Matt Kruse
                      Javascript Toolbox: http://www.JavascriptToolbox.com/


                      Comment

                      • Richard Cornford

                        #26
                        Re: two dropdown menus

                        Matt Kruse wrote:[color=blue]
                        > Richard Cornford wrote:[/color]
                        <snip>[color=blue]
                        > It is my goal to have most of my scripts packaged into jsp taglibs
                        > (some most likely tied to struts, which is what I work with on a
                        > daily basis). It works great. It just takes _more_ time, of which I
                        > don't have enough...[/color]

                        Thinking about your "Available features" and "Extensibility" . I was
                        wondering about the potential for having separate software assemble js
                        files from a pre-defined "library" based on only the specified required
                        features as a way of dealing with the code bloat problem, at least
                        partly.

                        Given a sufficiently modular design providing a number of utility
                        functions and a basic object with the minimal common functionality, and
                        then a series of augmentation methods; the software could understand the
                        relationships between the components and output a js file that included
                        any required utilities, the basic object and the augmentation methods
                        needed to achieve any combination of features required, but no more.
                        Leaving the person deploying the code using no more (or little more)
                        than just what was needed for the task, and so no code bloat.

                        That would leave you free to stuff as many features in as you wanted to
                        into the system because that would not impact on everyone using the
                        "library", beyond the extent that they actually wanted those features.
                        It would also allow features to be explicitly mutually exclusive in a
                        way that could not be achieved in a single file.

                        <snip>[color=blue][color=green][color=darkred]
                        >>> Your date picker script on your example page would be unacceptable
                        >>> to most clients I've worked with because of the UI.[/color]
                        >> Specifically?[/color]
                        >
                        > It's unlike the interface many users are used to,[/color]

                        I lifted the design straight from a standard piece of windows software,
                        so its users will be familiar, it just wasn't Outlook. I really don't
                        think it would be that hard to work out anyway, a calendar is a
                        calendar. It is not that different form some of the permutations of
                        yours except visually, but a bit of CCS could change that.
                        [color=blue]
                        > and it covers up the input field.[/color]

                        When a positioning algorithm can hit an input field it can easily be
                        modified to avoid it, if that was a requirement. I lent towards the
                        opinion that the pop-up calendar represented an alternative means of
                        inputting the date, so the original field is not needed simultaneously.
                        [color=blue]
                        > It also activates whether the user wants it to or not.[/color]

                        It activates onmouseup on the input field, so only when the user is
                        traversing the form with a pointing device in their hand, thus likely to
                        appreciate a pointing device orientated means of quickly inputting the
                        date.
                        [color=blue]
                        > Annoying for keyboard-users who happen to have a capable browser.[/color]

                        Keyboard users tend to tab between fields so they will not be seeing it
                        at all.

                        <snip>[color=blue]
                        > Rather, I'd say that others came to the same erroneous
                        > conclusion I did, based on not testing
                        > assumptions we assumed would always be true[/color]

                        There are people who say "make *no* assumptions about browsers". There
                        are some things that I would be willing to assume, the existence of -
                        document -, some common global functions/objects, ECMA 262 2nd edition
                        specified global functions/objects, but that is about it. Everything
                        else needs verifying first, or handling in a way that is safe.
                        [color=blue]
                        > (that the options collection would have a length). Testing
                        > for the obvious could add a lot of bloat to scripts.[/color]

                        Very little seems obvious once you start looking into browser DOMs.
                        Suitable testing will increase the size of scripts, but isn't really
                        optional if the results are going to be reliable. Probably a more
                        significant impact follows form how that testing is implemented as the
                        wrong strategy can seriously burden the execution speed and efficiency
                        of code. The fact that extensive testing is necessary and that testing
                        increases the amount of code used just provides an additional reason for
                        not including code that is not used.

                        <snip>[color=blue][color=green][color=darkred]
                        >>> ... . I think libraries are fantastic, and have a lot of
                        >>> value for many developers. You disagree.[/color][/color][/color]
                        [color=blue][color=green]
                        >> And I didn't turn out to be alone in that opinion did I?[/color]
                        >
                        > Nor am I alone in my opinion.[/color]

                        But you didn't find anyone who has demonstrated an understanding of
                        browser scripting to publicly express that opinion.
                        [color=blue][color=green]
                        >> The date picker code is not exactly formatted for being read.[/color]
                        >
                        > s/formatted/coded/[/color]

                        If I wrote code that I would have found understandable with the
                        knowledge that I had two years ago there would have been no point in
                        learning what I have learnt over the intervening period (it surprised me
                        that there was so much more to be learnt, but I don't regret making the
                        effort).

                        I have seen it argued, by Java programmes, that javascript should be
                        authored in an exclusively Java-like style. That would be possible, and
                        would produce code that was more comprehensible to Java programmers, but
                        they are not the same language and some of javascript's most powerful
                        features would become unavailable. And they are features that really
                        lend themselves well to the problems of browser scripting.

                        However, occasionally, when the subject of obfuscation of client-side
                        code has come up, I have suggested that code that fully exploits
                        javascript as a language doesn't really need obfuscation as anyone who
                        can understand how it works can write it for themselves and so doesn't
                        need to steal it.

                        But given a suitably modular and OO approach the techniques use to
                        implement something (however advanced they may be) don't represent a bar
                        to the use of that code by less skilled authors. With a properly
                        documented public interface the internal details of components don't
                        impact on their usability (so long as they work as advertised).

                        <snip>[color=blue]
                        > My libraries are made up of a lot of smaller functions which perform
                        > specific tasks.
                        > Even if you disagree with combining the functions into libraries,
                        > individual functions could be critiqued for their ability to perform
                        > the specific task for which they were written.[/color]

                        If you post code chances are that someone will critique it.
                        [color=blue][color=green][color=darkred]
                        >>> ... . Multiple people working together to
                        >>> create the best possible solutions would be fantastic.[/color]
                        >> My experience of problem solving says: stage 1. Identify the problem.
                        >> And uses that to define what would qualify as a solution.[/color]
                        >
                        > I have no idea how that relates to what I said.[/color]

                        You want to create a "best possible solution". "Best" implies some sort
                        of ranking criteria that would differentiate between "possible
                        solutions". "Possible" implies realisable or achievable; a demonstrable
                        characteristic. And "solution" implies a problem. You won't create a
                        "best possible solution" until you know what the problem is that it is
                        going to solve.

                        Unless I am suffering from another of your overly flexible word
                        definitions and you mean something unexpected when you say "solution".

                        Richard.



                        Comment

                        • Matt Kruse

                          #27
                          Re: two dropdown menus

                          Richard Cornford wrote:[color=blue]
                          > Thinking about your "Available features" and "Extensibility" . I was
                          > wondering about the potential for having separate software assemble js
                          > files from a pre-defined "library" based on only the specified
                          > required features as a way of dealing with the code bloat problem, at
                          > least partly.[/color]

                          I've done this, and it turned out to be more hassle then it's worth. Also,
                          it stops being a purely javascript solution. You need some server-side
                          processing to assemble and deliver the javascript.

                          I've concluded that IMO, some 'code bloat' is acceptable. I compact my
                          library source to remove whitespace and comments and all that, which reduces
                          the size by 50%, usually. If I removed 'extra' code that I might not use on
                          a page, then I could maybe remove 5k or 10k from a big library. That's not
                          enough to even worry about, IMO.
                          [color=blue]
                          > Given a sufficiently modular design providing a number of utility
                          > functions and a basic object with the minimal common functionality,
                          > and then a series of augmentation methods; the software could
                          > understand the relationships between the components and output a js
                          > file that included any required utilities, the basic object and the
                          > augmentation methods needed to achieve any combination of features
                          > required, but no more.[/color]

                          Building a dependency chain into javascript functions and objects is a royal
                          PITA. I've done it, and decided it's more work than it's worth.
                          [color=blue]
                          > a calendar is a calendar. It is not that different form some of the
                          > permutations of yours except visually, but a bit of CCS could change
                          > that.[/color]

                          Your 'solution' is very limited, though. Can it change date format? Can it
                          parse user-entered dates and popup the calendar with the correct day
                          highlighted? Can you make some days unselectable? Can you make the week
                          start on any given day? Can month/day names be easily changed for
                          internationaliz ation? Can the calendar populate 3 separate d/m/y fields?
                          There are a lot of features that everyday users would find handy. Adding an
                          additional 5k of library code to have as many of those functions available,
                          tested, and working is a huge advantage to many developers, and definitely
                          adds 'value' to the script.
                          [color=blue][color=green]
                          >> It also activates whether the user wants it to or not.[/color]
                          > It activates onmouseup on the input field, so only when the user is
                          > traversing the form with a pointing device in their hand, thus likely
                          > to appreciate a pointing device orientated means of quickly inputting
                          > the date.[/color]

                          Hey, it's a fine way to implement it, just not a way that I find very
                          useable. It should hide when the user clicks off of it. It shouldn't hide
                          the field. It shouldn't popup without the user choosing to pop it up. All
                          IMO.

                          But, I'm not trying to be overly-picking about your date picker solution. It
                          looks like a fine script. I'm just explaining why I lean towards the
                          'library' approach, and building in functionality that many people find
                          useful, even if a number of people will never use that functionality.

                          --
                          Matt Kruse
                          Javascript Toolbox: http://www.JavascriptToolbox.com/


                          Comment

                          • Mike Foster

                            #28
                            Re: two dropdown menus

                            On Tue, 15 Jun 2004 08:26:14 +0100, Richard Cornford <Richard@litote s.demon.co.uk> wrote:
                            [color=blue]
                            > Thinking about your "Available features" and "Extensibility" . I was
                            > wondering about the potential for having separate software assemble js
                            > files from a pre-defined "library" based on only the specified required
                            > features as a way of dealing with the code bloat problem, at least
                            > partly.
                            >
                            > Given a sufficiently modular design providing a number of utility
                            > functions and a basic object with the minimal common functionality, and
                            > then a series of augmentation methods; the software could understand the
                            > relationships between the components and output a js file that included
                            > any required utilities, the basic object and the augmentation methods
                            > needed to achieve any combination of features required, but no more.
                            > Leaving the person deploying the code using no more (or little more)
                            > than just what was needed for the task, and so no code bloat.[/color]


                            Interesting you should say that ;-)

                            I have a tool (xLib) that does this for my library. Its just a beta tool
                            I use myself. Its a relatively simple C program which parses your
                            application files and makes a list of library functions used. It has a
                            table of function names and dependencies, and I have all library functions
                            in separate files, and so it builds a custom library file and applies a
                            little compression (optional).

                            This is how I create the library files that are downloadable from my site.
                            My choice of which functions to include in which files was just a compromise
                            because it makes it quicker to write the demos I put on the site. xLib makes
                            it easy to group certain functions I need into one file.

                            I even use xLib to create/update the function name and dependency table.

                            Mike

                            Comment

                            • Richard Cornford

                              #29
                              Re: two dropdown menus

                              Matt Kruse wrote:[color=blue]
                              > Richard Cornford wrote:[/color]
                              <snip>[color=blue][color=green]
                              >> a calendar is a calendar. It is not that different form some of the
                              >> permutations of yours except visually, but a bit of CCS could change
                              >> that.[/color]
                              >
                              > Your 'solution' is very limited, though.[/color]

                              Either that, or it is very specific.
                              [color=blue]
                              > Can it change date format?[/color]

                              That wasn't a specified requirement, but if it was it could be added.
                              [color=blue]
                              > Can it parse user-entered dates and popup the
                              > calendar with the correct day highlighted?[/color]

                              Currently it defaults to whatever is defined/enterd in the HTML, or
                              today otherwise. The date defaulting code would not be difficult to
                              modify to accept information as function call parameters, or whatever.
                              [color=blue]
                              > Can you make some days unselectable?[/color]

                              The resolution of unavailable dates is to the Year boundary. It could
                              also be parameterised if there was a need for more control.
                              [color=blue]
                              > Can you make the week start on any given day?[/color]

                              No more than I can turn back the tide :) But if you mean the ordering
                              of the day columns, yes of course I could, it would need a more complex
                              algorithm and more code (the current ordering is certainly the most
                              easily coded, and not that unexpected from a calendar).
                              [color=blue]
                              > Can month/day names be easily
                              > changed for internationaliz ation?[/color]

                              They are both in isolated Arrays so they could be swapped for other
                              nation/language specific dynamically or otherwise, if that was required.
                              [color=blue]
                              > Can the calendar populate 3 separate d/m/y fields?[/color]

                              That is what it does now (the second two being select elements).
                              [color=blue]
                              > There are a lot of features that everyday
                              > users would find handy.[/color]

                              Is this user "users" or developer "users"?
                              [color=blue]
                              > Adding an additional 5k of library code to have as many
                              > of those functions available, tested, and working is a
                              > huge advantage to many developers, and definitely adds
                              > 'value' to the script.[/color]

                              You comments so far centre on the way my script is not configurable to
                              every permutation of possible deployment. You want me to write library
                              style software products for use by third parties as you do, else you
                              will consider the results inferior. I am not going to do that, my script
                              is *one* specific implementation of a date picker, a demonstration. I
                              could write others, and maybe re-use much of the existing code in doing
                              so. But I will not write an all singing and dancing, 100% configurable,
                              multi-UI, multi-national date picker until that is the specific
                              specification (so not in my spare time).

                              While I disagree with the concept of client-side javascript libraries it
                              cannot be reasonable to criticise my scripts for not exhibiting
                              characteristics that are only called for in client-side javascript
                              libraries. If my scripts did have those characteristics it would mean my
                              design was inappropriate for the context and they would represent ground
                              for criticism in themselves.

                              I notice that you assert that this additional flexibility can be
                              accommodated in 5K.

                              You want to be able to change the date format. How many date formats are
                              there world wide? How many unicode characters represent numbers and/or
                              digits? Can you really cope with all the possibilities in 5K?

                              You want to swap the language for the labels. How many languages are
                              there world wide? How much space will all of their month names and day
                              abbreviations take up? Plus the corresponding digit character mappings
                              for the calendar body.

                              You wonder if dates can be pre selected. What about color-highlighting
                              local holidays? Internationally ? Other dates of interest/relevance? How
                              about highlighting week when hovering, or the day column, or both in
                              different colors?

                              You wonder if the column order can be changed. What about using rows
                              instead, ordered up or down (right to left) for different languages (if
                              that is normal for their calendars)?

                              You wonder how many fields it might populate. What would be the limit;
                              one to infinity? spread across multiple windows and frames? Different
                              types; input here, hidden there, the year to a select in another frame?
                              The first US slash separated date format in UTC, the second equivalent
                              local time in ISO format?

                              You want to have the position specifiable. Does it cover the input field
                              or not (or partly overlap with an offset)? If not is it going to be
                              above it, below it, to the left or right, offset by how much, offset at
                              an arbitrary angle, by pixels, em or cm? Or is it positioned relative to
                              any arbitrary element, or absolutely positioned. Is its position
                              adjusted so that it will be within the client area or might the user
                              have to scroll to get to all of it? Should it be dragable?

                              You think it should close onmousedown outside of the picker. What about
                              onmouseout, with a close button, onkeydown/press/up outside, onfoucs for
                              any other control/link? What happens if an event handler is already
                              assigned to any element that might be considered relevant? What if
                              someone wants opening onmouseover some other element?

                              How many other possibilities might suggest themselves? Scripting to a
                              specification can attempt to provide all of what *is* wanted, a library
                              cannot practically provide all of what *may* be wanted (even if
                              everything could be anticipated). A line must be drawn, and with only 5K
                              to play with that line is not going to be too far from where it is now.
                              So the library, no matter how feature packed and flexible, ultimately
                              defines the outcome. And the harder it tries to avoid that the more it
                              will become bloated with features that some may want but most will not.
                              [color=blue][color=green][color=darkred]
                              >>> It also activates whether the user wants it to or not.[/color]
                              >> It activates onmouseup on the input field, so only when the user is
                              >> traversing the form with a pointing device in their hand, thus likely
                              >> to appreciate a pointing device orientated means of quickly inputting
                              >> the date.[/color]
                              >
                              > Hey, it's a fine way to implement it, just not a way that I find very
                              > useable.[/color]
                              [color=blue]
                              > It should hide when the user clicks off of it.[/color]

                              As few as 8 lines of code will do that if the deployment context is
                              known not to include a document.onmous edown handler. For an unknown
                              context either much more code is needed or cross-browser support would
                              be restricted. Ultimately it is a matter of someone deciding that it is
                              something they want (and that implies the context of its use).
                              [color=blue]
                              > It shouldn't hide the field.[/color]

                              Why not? It is not as if you can do anything with the field while it is
                              showing (as you want the picker closed on any mousedown in the
                              document).
                              [color=blue]
                              > It shouldn't popup without the user choosing to pop it up.[/color]

                              By implication clicking on the Date field is a request to be able to
                              enter a date, and the date picker being easy to use with the pointing
                              device implied by the method of activation might easily justify making
                              that facility available when date entering is requested. It is really
                              just a matter of UI style, if someone wanted it activated otherwise that
                              wouldn't be at all difficult to arrange.

                              Richard.



                              Comment

                              • Matt Kruse

                                #30
                                Re: two dropdown menus

                                Richard Cornford wrote:[color=blue]
                                > You comments so far centre on the way my script is not configurable to
                                > every permutation of possible deployment.[/color]

                                My comments point out common requirements for developers around the world
                                trying to implement a date-picker popup. Having had my date picker available
                                for qutie some time, and having received hundreds of suggestions and feature
                                requests, I'm fairly familiar with the requirements that most developers
                                have when looking for such a script. Surely no one can meet all requirements
                                that anyone might have. But solving the vast majority of typical
                                requirements is definitely possible.

                                My point in raising those questions was to show that your solution is very
                                specific to a single set of requirements, and therefore not very useful to
                                very many people. My solution - although more 'bloated' with code - is built
                                to meet a wide range of common requirements, and therefore it is very useful
                                to a lot of people. This is not to knock your solution - it may be _perfect_
                                for someone. The point is to examine what 'value' each of our aproaches
                                offers to potential developers who wish to implement a date picker.

                                If someone wishes to implement a date picker using your philosophy of
                                javascript development, they would need to download your code, fully
                                understand it (and it is unreadable to most people), then customize it to
                                add the required functionality. This could be very time-consuming.

                                Or, they could download my library, customize the display with a few lines
                                of code using built-in parameters and methods, and have their requirements
                                met in a few minutes. And have the date picker work on a wider range of
                                browsers. At the expense of an additional few kb of code 'bloat'.

                                If you were a non-expert developer wishing to add a date-picker popup to
                                your page, which solution do you think you would prefer? You may disagree,
                                but I think most people would clearly prefer the latter. You have offered a
                                solution which meets the requirements of very very few developers. I have
                                offered a solution which meets the requirements of thousands of developers.
                                And that is why I build libraries, and why I think the library concept is
                                superior for general use and distribution than your philosophy.
                                [color=blue]
                                > I notice that you assert that this additional flexibility can be
                                > accommodated in 5K.[/color]

                                Your code is 23k, mine is 34k. So, I estimated wrong - an additional 11k is
                                required. But that also adds many more features than what I noted ;)

                                --
                                Matt Kruse
                                Javascript Toolbox: http://www.JavascriptToolbox.com/


                                Comment

                                Working...