setTimeout not executing form submit

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lasse Reichstein Nielsen

    #16
    Re: setTimeout not executing form submit

    Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:
    [color=blue]
    > ACK, though I would prefer
    >
    > setTimeout(func tion foo() { obj.method(); }, 2000);
    >
    > for backwards compatibility.[/color]

    Depending on how much you care about backwarts compatability,
    you might have to do:
    setTimeout("glo bal.path.to.obj .method()",2000 );

    I don't like writing code inside strings, for many of the same reasons
    that I don't like using "eval", but IE 4 and NS 3 needs it.

    Which browsers will not understand anonymous functions, but do
    understand functional arguments to setTimeout? I don't know of any
    on the Windows platform.

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

    Comment

    • Dr John Stockton

      #17
      Re: setTimeout not executing form submit

      JRS: In article <40880612.20006 01@PointedEars. de>, seen in
      news:comp.lang. javascript, Thomas 'PointedEars' Lahn
      <PointedEars@we b.de> posted at Thu, 22 Apr 2004 19:51:14 :
      [color=blue]
      >BTW: Your From address violates Internet/NetNews standards.[/color]

      I doubt it. Please quote the standard to which you refer.

      By the way, Hunnish attitudes went quite out of fashion after 1914-1918.

      If Thomas Lahn is your real name, and if a potential employer should
      search the Net for it, then ISTM that he/she will discover the
      unattractivenes s of your personality.

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

      Comment

      • Jim Ley

        #18
        Re: setTimeout not executing form submit

        On Wed, 21 Apr 2004 05:28:06 +0200, Thomas 'PointedEars' Lahn
        <PointedEars@we b.de> wrote:
        [color=blue]
        > the IE-DOM does support
        >function references from v5.0 on, but not additional arguments to date
        >(IE 6.0 SP-1) --[/color]

        There's no way it can since that would break compatibility with every
        previous version of _IE_ remember IE's DOM methods are not tied to a
        particular script language, and the 3rd parameter of setTimeout is the
        language.

        setTimeout is a lousy way to cause a delay in a DOM anyway.

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

        Comment

        • Jim Ley

          #19
          Re: setTimeout not executing form submit

          On Thu, 22 Apr 2004 19:26:06 +0200, Thomas 'PointedEars' Lahn
          <PointedEars@we b.de> wrote:
          [color=blue]
          >setTimeout() is a method of the global object, so the object calling
          >theFormSubmit( ) is always the global object.[/color]

          no setTimeout is a method of the window object, it may not be the same
          as the global object

          win=window.open ('','a');
          win.setTimeout( "alert(this.nam e)",100)

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

          Comment

          • Jim Ley

            #20
            Re: setTimeout not executing form submit

            On Fri, 23 Apr 2004 19:06:54 +0200, Lasse Reichstein Nielsen
            <lrn@hotpop.com > wrote:
            [color=blue]
            >Which browsers will not understand anonymous functions, but do
            >understand functional arguments to setTimeout? I don't know of any
            >on the Windows platform.[/color]

            ASV3 with its internal script engine will IIRC.

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

            Comment

            • Thomas 'PointedEars' Lahn

              #21
              Re: setTimeout not executing form submit

              Lasse Reichstein Nielsen wrote:
              [color=blue]
              > Which browsers will not understand anonymous functions, but do
              > understand functional arguments to setTimeout? I don't know of any
              > on the Windows platform.[/color]

              As for JavaScript, the definition of anonymous functions _using the
              "function" operator_ is described to be possible since JavaScript 1.5.

              <devedge.netsca pe.com/library/manuals/2000/javascript/1.5/reference/ops.html#106634 4>

              It nevertheless works in Netscape 4.8 that is described to support
              JavaScript 1.3 or 1.4 only.

              Passing a Function object reference to setTimeout() is possible in
              JavaScript 1.2 and 1.3 (the window object is removed from the core
              language in v1.4):

              <devedge.netsca pe.com/library/manuals/2000/javascript/1.3/reference/window.html#120 3758>


              But the Gecko DOM Reference is misleading:

              <http://www.mozilla.org/docs/dom/domref/dom_window_ref1 15.html#1021427 >

              Gecko in fact supports both strings and Function object references as first
              argument for setTimeout().


              As for JScript, the "function" operator is _not specified_ (it is not even
              specified that the function identifier may be omitted in the "function"
              statement specification, if we assume that what is specified as operator
              in ECMAScript 3 is considered a statement in JScript:

              <http://msdn.microsoft. com/library/default.asp?url =/library/en-us/script56/html/js56jslrfjscrip tstatementstoc. asp>

              ) but working as supposed in IE 5.01 SP2 (NT version) with JScript 5.1.5010
              and IE 6.0 SP2 (Win2k) with JScript 5.6.8513. I would be glad if someone
              who has IE < 5 installed would test this.

              The MS implementation of setTimeout() takes a Function object reference
              (described as "function pointer") from IE version 5 on:

              <http://msdn.microsoft. com/library/default.asp?url =/workshop/author/dhtml/dhtml_node_entr y.asp>

              Tested successfully with both of the above UAs/script engines.


              Opera 6.05+ supports both features.


              HTH

              PointedEars

              Comment

              • Thomas 'PointedEars' Lahn

                #22
                Re: setTimeout not executing form submit

                Jim Ley wrote:
                [color=blue]
                > [...] Thomas 'PointedEars' Lahn [...] wrote:[color=green]
                >> the IE-DOM does support function references from v5.0 on, but not
                >> additional arguments to date (IE 6.0 SP-1) --[/color]
                >
                > There's no way it can since that would break compatibility with every
                > previous version of _IE_[/color]

                Why? Scripts for previous versions would not use the third argument.
                [color=blue]
                > remember IE's DOM methods are not tied to a particular script language,
                > and the 3rd parameter of setTimeout is the language.[/color]

                If the script engine does not support the additional feature that's OK, but
                there are other examples (take try...catch..fi nally or non-greedy RegExp
                quantifiers) where this was done.
                [color=blue]
                > setTimeout is a lousy way to cause a delay in a DOM anyway.[/color]

                Are you proposing a sleep() method instead, blocking the UA when called?


                PointedEars

                Comment

                • Lasse Reichstein Nielsen

                  #23
                  Re: setTimeout not executing form submit

                  Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:
                  [color=blue]
                  > Are you proposing a sleep() method instead, blocking the UA when called?[/color]

                  That would probably be what most people really want.
                  It doesn't have to block the UA, just the current execution context.
                  It should then resume executing after the time us up, or at least
                  as soon as no other scheduled execution is running. It could work.

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

                  Comment

                  • optimistx

                    #24
                    Re: setTimeout not executing form submit

                    Dr John Stockton wrote:[color=blue]
                    > JRS: In article <40880612.20006 01@PointedEars. de>, seen in
                    > news:comp.lang. javascript, Thomas 'PointedEars' Lahn
                    > <PointedEars@we b.de> posted at Thu, 22 Apr 2004 19:51:14 :
                    >
                    >[color=green]
                    >>BTW: Your From address violates Internet/NetNews standards.[/color]
                    >
                    >
                    > I doubt it. Please quote the standard to which you refer.
                    >
                    > By the way, Hunnish attitudes went quite out of fashion after 1914-1918.
                    >
                    > If Thomas Lahn is your real name, and if a potential employer should
                    > search the Net for it, then ISTM that he/she will discover the
                    > unattractivenes s of your personality.
                    >[/color]
                    It is easier to tolerate and understand astonishing features, if one
                    puts e.g. an expression 'asperger syndrome' to google.com and reads some
                    key articles.

                    It helps me tolerate by imagining that my sick child would try to
                    continue his/her living here with the resources he/she has.

                    Comment

                    • Thomas 'PointedEars' Lahn

                      #25
                      Re: setTimeout not executing form submit

                      optimistx wrote:[color=blue]
                      > Dr John Stockton wrote:[color=green]
                      >> Thomas 'PointedEars' Lahn <PointedEars@we b.de> posted:[color=darkred]
                      >>> BTW: Your From address violates Internet/NetNews standards.[/color]
                      >>
                      >> I doubt it. Please quote the standard to which you refer.[/color][/color]

                      | From: Michael Winter <M.Winter@bluey onder.co.invali d>
                      ^^^^^^^^

                      [2004-04-24 17:47:26] pointedears:/var
                      $ chkmadd -v M.Winter@blueyo nder.co.invalid
                      chkmadd 0.1.2.200404220 6 -- (C) 2003, 2004 Thomas Lahn <mehl@PointedEa rs.de>
                      Distributed under the terms of the GNU General Public License (GPL).
                      See COPYING file or <http://www.fsf.org/copyleft/gpl.html> for details.
                      Report bugs to <chkmadd@Pointe dEars.de>.

                      E-mail address(es) to check:
                      M.Winter@blueyo nder.co.invalid

                      Verifying <M.Winter@bluey onder.co.invali d> ...
                      Mail exchanger(s) for blueyonder.co.i nvalid:
                      None.
                      Mail exchanger(s) for co.invalid:
                      None, thus <M.Winter@bluey onder.co.invali d>
                      is definitely not an e-mail address (no MX).

                      ---------------------
                      Network Working Group D. Eastlake
                      Request for Comments: 2606 A. Panitz
                      BCP: 32 June 1999
                      Category: Best Current Practice

                      Reserved Top Level DNS Names

                      [...]

                      Abstract

                      To reduce the likelihood of conflict and confusion, a few top level
                      ^^^^^^^^^^^^^^^
                      domain names are reserved for use in private testing, as examples in
                      ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^
                      documentation, and the like. In addition, a few second level domain
                      ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
                      names reserved for use as examples are documented.

                      [...]

                      2. TLDs for Testing, & Documentation Examples
                      ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^
                      There is a need for top level domain (TLD) names that can be used for
                      creating names which, without fear of conflicts with current or
                      future actual TLD names in the global DNS, can be used for private
                      ^^^^^^^^^^^^^^^ ^^^^^^^^
                      testing of existing DNS related code, examples in documentation, DNS
                      ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^
                      related experimentation , invalid DNS names, or other similar uses.
                      ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^

                      For example, without guidance, a site might set up some local
                      additional unused top level domains for testing of its local DNS code
                      and configuration. Later, these TLDs might come into actual use on
                      the global Internet. As a result, local attempts to reference the
                      real data in these zones could be thwarted by the local test
                      versions. Or test or example code might be written that accesses a
                      TLD that is in use with the thought that the test code would only be
                      run in a restricted testbed net or the example never actually run.
                      Later, the test code could escape from the testbed or the example be
                      actually coded and run on the Internet. Depending on the nature of
                      the test or example, it might be best for it to be referencing a TLD
                      permanently reserved for such purposes.

                      To safely satisfy these needs, four domain names are reserved as
                      listed and described below.

                      .test
                      .example
                      .invalid
                      .localhost

                      [...]

                      ".invalid" is intended for use in online construction of domain
                      names that are sure to be invalid and which it is obvious at a
                      glance are invalid.

                      [...]

                      ---------------------
                      Network Working Group P. Resnick, Editor
                      Request for Comments: 2822 QUALCOMM Incorporated
                      Obsoletes: 822 April 2001
                      Category: Standards Track

                      Internet Message Format

                      [...]

                      3.6.2. Originator fields

                      The originator fields of a message consist of the from field, the
                      sender field (when applicable), and optionally the reply-to field.
                      The from field consists of the field name "From" and a
                      comma-separated list of one or more mailbox specifications. If the
                      from field contains more than one mailbox specification in the
                      mailbox-list, then the sender field, containing the field name
                      "Sender" and a single mailbox specification, MUST appear in the
                      message. In either case, an optional reply-to field MAY also be
                      included, which contains the field name "Reply-To" and a
                      comma-separated list of one or more addresses.

                      from = "From:" mailbox-list CRLF

                      [...]


                      3.4. Address Specification

                      Addresses occur in several message header fields to indicate senders
                      and recipients of messages. An address may either be an individual
                      mailbox, or a group of mailboxes.

                      [...]

                      mailbox = name-addr / addr-spec

                      name-addr = [display-name] angle-addr

                      name-addr = [display-name] angle-addr

                      angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr

                      [...]

                      A mailbox receives mail. [...]
                      ^^^^^^^^^^^^^^^ ^^^^^^^^^
                      ---------------------

                      A good informal explanation why such address munging is a Bad Thing[1]:

                      <http://www.interhack.n et/pubs/munging-harmful/>


                      HTH & HAND

                      PointedEars
                      ___________
                      [1] http://catb.org/~esr/jargon/html/B/Bad-Thing.html

                      Comment

                      • Dr John Stockton

                        #26
                        Re: setTimeout not executing form submit

                        JRS: In article <408A9BEA.40409 @PointedEars.de >, seen in
                        news:comp.lang. javascript, Thomas 'PointedEars' Lahn
                        <PointedEars@we b.de> posted at Sat, 24 Apr 2004 18:55:06 :[color=blue]
                        >optimistx wrote:[color=green]
                        >> Dr John Stockton wrote:[color=darkred]
                        >>> Thomas 'PointedEars' Lahn <PointedEars@we b.de> posted:
                        >>>> BTW: Your From address violates Internet/NetNews standards.
                        >>>
                        >>> I doubt it. Please quote the standard to which you refer.[/color][/color][/color]

                        [color=blue]
                        >Network Working Group D. Eastlake
                        >Request for Comments: 2606 A. Panitz
                        >BCP: 32 June 1999
                        >Category: Best Current Practice[/color]
                        [color=blue]
                        > To reduce the likelihood of conflict and confusion, a few top level
                        > ^^^^^^^^^^^^^^^
                        > domain names are reserved for use in private testing, as examples in
                        > ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^
                        > documentation, and the like.[/color]


                        Note - "and the like".

                        [color=blue]
                        > ".invalid" is intended for use in online construction of domain
                        > names that are sure to be invalid and which it is obvious at a
                        > glance are invalid.[/color]


                        The TLD having been declared unusable for cross-net communication, it is
                        entirely reasonable to use it for non-communication.

                        Circumstances have changed since the time when it was not felt necessary
                        for that document to deal with anti-spam precautions, so nothing can be
                        read into the omission in respect to present-day usage.

                        Grow up. Remember what happened to Benito - according to Niven &
                        Pournelle, he eventually reaped the reward of honourable behaviour.

                        --
                        © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
                        <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
                        <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
                        <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

                        Comment

                        • Jim Ley

                          #27
                          Re: setTimeout not executing form submit

                          On Fri, 23 Apr 2004 22:46:48 +0200, Thomas 'PointedEars' Lahn
                          <PointedEars@we b.de> wrote:
                          [color=blue]
                          >Jim Ley wrote:
                          >[color=green]
                          >> [...] Thomas 'PointedEars' Lahn [...] wrote:[color=darkred]
                          >>> the IE-DOM does support function references from v5.0 on, but not
                          >>> additional arguments to date (IE 6.0 SP-1) --[/color]
                          >>
                          >> There's no way it can since that would break compatibility with every
                          >> previous version of _IE_[/color]
                          >
                          >Why? Scripts for previous versions would not use the third argument.[/color]

                          yet, it's near impossible to do version detection of javascript...
                          [color=blue][color=green]
                          >> setTimeout is a lousy way to cause a delay in a DOM anyway.[/color]
                          >
                          >Are you proposing a sleep() method instead, blocking the UA when called?[/color]

                          Nope, my proposal (which you can see in the www-svg archives) would be
                          for a delayed dispatchEvent. Although even the current SVG 1.2
                          proposal I welcome as better than setTimeout, which really is lousy.

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

                          Comment

                          • Yann-Erwan Perio

                            #28
                            Re: setTimeout not executing form submit

                            Jim Ley wrote:
                            [color=blue]
                            > yet, it's near impossible to do version detection of javascript...[/color]

                            Ah, but I assume that detecting JScript wouldn't be too hard, using
                            conditional compilation and VBArrays...or not?
                            [color=blue]
                            > Nope, my proposal (which you can see in the www-svg archives) would be
                            > for a delayed dispatchEvent. Although even the current SVG 1.2
                            > proposal I welcome as better than setTimeout, which really is lousy.[/color]

                            When reading your first answer I was about to exemplify good uses for
                            setTimeout (other than addressing browser lack of support for events),
                            but the more I think to that delayed dispatchEvent, the more valid it
                            seems to be.

                            I'm not familiar with SVG yet, scanning the SVG1.2 draft yielded the
                            SVGRunnable and SVGTimer interfaces, do you really prefer this over
                            setTimeout?

                            I mean, it's possible to implement elegant components using setTimeout,
                            and to me the spec is just proposing an interface to such a component,
                            which, though IMHO quite correct, remains easily done with javascript
                            and setTimeout, and seems moreover to be missing the spirit of an
                            events-based system.

                            At least setTimeout is much more fun:-), and it being easy to use means
                            more flexibility for the programmer - I don't see any real added value
                            or innovation in the SVG two interfaces.

                            As for the "sleep" method, I hate the idea - that'd split the execution
                            context, so that would deal with javascript, while the timeout only
                            deals with the host, much neater.


                            Cheers,
                            Yep.

                            Comment

                            • Thomas 'PointedEars' Lahn

                              #29
                              Re: setTimeout not executing form submit

                              Jim Ley wrote:
                              [color=blue]
                              > Thomas 'PointedEars' Lahn wrote:[color=green]
                              >> Jim Ley wrote:[color=darkred]
                              >>> [...] Thomas 'PointedEars' Lahn [...] wrote:
                              >>>> the IE-DOM does support function references from v5.0 on, but not
                              >>>> additional arguments to date (IE 6.0 SP-1) --
                              >>>
                              >>> There's no way it can since that would break compatibility with every
                              >>> previous version of _IE_[/color]
                              >>
                              >> Why? Scripts for previous versions would not use the third argument.[/color]
                              >
                              > yet, it's near impossible to do version detection of javascript...[/color]

                              Since JavaScript methods do not have fixed arity I still do not see the
                              problem. No edition/version of ECMAScript, JavaScript and JScript is 100%
                              backwards compatible.
                              [color=blue][color=green][color=darkred]
                              >>> setTimeout is a lousy way to cause a delay in a DOM anyway.[/color]
                              >> Are you proposing a sleep() method instead, blocking the UA when called?[/color]
                              >
                              > Nope, my proposal (which you can see in the www-svg archives) would be
                              > for a delayed dispatchEvent. [...][/color]

                              ACK, a standards compliant way of setting a timeout is required.


                              PointedEars

                              Comment

                              • Jim Ley

                                #30
                                Re: setTimeout not executing form submit

                                On Mon, 26 Apr 2004 22:24:47 +0200, Yann-Erwan Perio
                                <y-e.perio@em-lyon.com> wrote:

                                [color=blue]
                                >I'm not familiar with SVG yet, scanning the SVG1.2 draft yielded the
                                >SVGRunnable and SVGTimer interfaces, do you really prefer this over
                                >setTimeout?[/color]

                                Possibly not over the setTimeout which takes function reference as
                                first parameter, and other optional parameters, however due to the
                                built in weight of setTimeout if it was standardised, everyone would
                                expect setTimeout("chi cken()",100) to work, and I think that's
                                horrible.

                                [color=blue]
                                >I mean, it's possible to implement elegant components using setTimeout,
                                >and to me the spec is just proposing an interface to such a component,
                                >which, though IMHO quite correct, remains easily done with javascript
                                >and setTimeout, and seems moreover to be missing the spirit of an
                                >events-based system.[/color]

                                Yep, Jan-Klaas Kollhof has implemented it using setTimeout, the
                                problem with setTimeout is that with the compilation you can't do it
                                in the compact profile of ECMAScript or in most other langauges, and
                                DOM is supposed to be language neutral.

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

                                Comment

                                Working...